FileName Field

  • Thread starter Thread starter Kerry
  • Start date Start date
K

Kerry

Hi

I would like to display the filename of my document in
the footer but I do not want the .doc on the end - is
this possible or do you have any suggestions on how else
I could display this information automatically?

Thanks very much.

Kerry
 
Use the following macro:

Sub InsertNameNoExt()
Dim fname, fname2 As String
If ActiveDocument.Saved = False Then ActiveDocument.Save
'fname = Selection.Document.FullName
'Replace the following line with the previous line if you want the path also
fname = Selection.Document.Name
fname2 = Left(fname, (Len(fname) - 4))
Selection.TypeText fname2
End Sub

which will place the filename (or path and filename) at the cursor. If you
don't know what to do with the code - see
http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

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