Group:  Microsoft Word ยป microsoft.public.word.docmanagement
Thread: Modify feilds

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Modify feilds
WayneL 27.09.2006 12:51:02
How can I mondify the FileName feild so that it just gives me the
filename without the extention, with say Left(FileName,8).
Is there someway of using VBA say NoExt = FileName, then say insert
that into a feild?

WayneL



Re: Modify feilds
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 27.09.2006 13:38:21
No - but you can insert the filename (or filename and path) without the
extension directly into the document with a vba eg

Sub InsertfNameAndPath()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.FullName, (Len(.FullName) - 4))
End With
Selection.TypeText pPathname
End Sub

Sub InsertFnameOnly()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.Name, (Len(.Name) - 4))
End With
Selection.TypeText pPathname
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


WayneL wrote:
[Quoted Text]
> How can I mondify the FileName feild so that it just gives me the
> filename without the extention, with say Left(FileName,8).
> Is there someway of using VBA say NoExt = FileName, then say insert
> that into a feild?
>
> WayneL


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net