FileName Field

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
 
G

Graham Mayor

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


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

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