Modify feilds

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top