Footer field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am wanting to show the name of the document in the footer but without the
document extension (.doc) Please could somebody explain how I would do this.

Thanks
 
The Word FILENAME field uses the settings of Windows Explorer; and you
cannot work around that. Maybe you can get the file name minus the
extension with a macro, but you'll have to ask in a VBA newsgroup to
find out.
 
skylark_za said:
I am wanting to show the name of the document in the footer but
without the document extension (.doc) Please could somebody explain
how I would do this.

Thanks

You cannot do it with a field, but it is easy enough to achieve with a
macro. The first macro will insert the name and path, the second just the
name.


Sub InsertfNameAndPath()
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) - 4))
Selection.TypeText pathname
End Sub

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

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


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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Graham

Your macros do what you say however how do I get this to update should I now
save the document as another name? The footer shows the name of the saved
document and the name of this document can change. (I hope this all makes
sense?)

Thanks
 
Obviously it doesn't. As indicated you cannot achieve this with a field. You
would need to replace the information. However, there should be no reason to
change the name of the document. Save the document as a template (along with
the macros) and create a new document each time.

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

My web site www.gmayor.com

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