Printing file path on document

  • Thread starter Thread starter Jeff Wachtel
  • Start date Start date
If you want the filename and path then you can use the filename and path
autotext entry which adds a {filename/p} field. If you want the path without
the filename then that's a bit more tricky and you'll need a macro to
separate the filename from the filename and path and print the path only eg

Sub InsertPath()
Dim fname, fname2, pathname As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
fname = Selection.Document.FullName
fname2 = Selection.Document.Name
pathname = Left(fname, (Len(fname) - (Len(fname2))))
Selection.TypeText pathname
End Sub

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

My web site www.gmayor.com

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