I have a request from a user to provide a macro for Word XP that will display
the complete network filepath and document name as a footer in a document.
(i.e. S:\ALS\folder1\subfolder2\documentname).
I have no programming experience. Can anyone help me? Any response is
appreciated.
David
Jean-Guy Marcil - 22 Nov 2004 15:36 GMT
Satara15 was telling us:
Satara15 nous racontait que :
> I have a request from a user to provide a macro for Word XP that will
> display the complete network filepath and document name as a footer
> in a document. (i.e. S:\ALS\folder1\subfolder2\documentname).
> I have no programming experience. Can anyone help me? Any response is
> appreciated.
You do not need a macro for that.
View > Header and Footer
Place the cursor in the footer
On the H/F toolbar, the first button is "Insert Autotext"
Choose "File Name and Location"

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Jay Freedman - 22 Nov 2004 15:42 GMT
> I have a request from a user to provide a macro for Word XP that will
> display the complete network filepath and document name as a footer
[quoted text clipped - 3 lines]
>
> David
Hi David,
You don't need a macro for this. Open the Footer pane, click the AutoText
button on the Header/Footer toolbar, and select "Filename and path". That
will insert a field to show the information.
You can also insert the same field without using AutoText. Click Insert >
Field > Filename and check the box for "Add path to filename", which gives a
field with the code {FILENAME \p}.
The field does not update automatically when you use File > Save As to make
a copy of the document with a different name. You can select the field and
press F9 to update it, or you can go to Print Preview (assuming "Update
fields" is checked in Tools > Options > Print).

Signature
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Satara15 - 22 Nov 2004 16:49 GMT
Merci, Jean-Guy!
Thank you, Jay.
Both replies were very helpful. It just goes to show you can teach an old
dog (me) new tricks.
David
> I have a request from a user to provide a macro for Word XP that will display
> the complete network filepath and document name as a footer in a document.
[quoted text clipped - 3 lines]
>
> David
Chuck - 24 Nov 2004 15:23 GMT
There may be times when you do need a macro to insert the path/filename (for
instance adding it to a menu/toolbar to make it easier for users to do
themselves, or to use as a component in another macro). Here's the code,
which you can also generate yourself using the Record Macro feature and then
creating the field while recording the macro. The code below will insert the
field wherever the cursor is -- you can create separate code that will insert
fields into headers/footers/etc.
Sub FilenameField()
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:="FILENAME \p "
End Sub
> I have a request from a user to provide a macro for Word XP that will display
> the complete network filepath and document name as a footer in a document.
[quoted text clipped - 3 lines]
>
> David