Printing file path on document

G

Graham Mayor

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top