How do I embed the file location into the document

  • Thread starter Thread starter Steve M
  • Start date Start date
If you only want the path (without the filename) you will need a macro. The
following will put the path at the cursor

Sub InsertPath()
Dim pPathname As String
Dim pFoldername As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
pPathname = Left$(.FullName, _
(Len(.FullName) - Len(.name) - 1))
pFoldername = Right$(pPathname, _
(Len(pPathname) - InStrRev(pPathname, "\")))
End With
Selection.TypeText pPathname
End Sub

http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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