Does Word have Directory Path field ?

M

moonhkt

Hi All
In header, I want add directory field after filename , Does word have
directory path field ?
If no, how to create a field for directory path ?

e.g when save file in c:\doc\2010\abc.doc, I want "c:\doc\2010"
before filename.
 
G

Graham Mayor

Use a \p switch on a filename field to add the path to the filename
i.e. { Filename \p }
There is no field that will provide just the path. If you only want the path
then you will need to use a macro.

Sub InsertPath()
With ActiveDocument
If Len(.Path) = 0 Then .Save
Selection.TypeText .Path & "\"
End With
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

moonhkt

Use a \p switch on a filename field to add the path to the filename
i.e. { Filename \p }
There is no field that will provide just the path. If you only want the path
then you will need to use a macro.

Sub InsertPath()
    With ActiveDocument
        If Len(.Path) = 0 Then .Save
        Selection.TypeText .Path & "\"
    End With
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web sitewww.gmayor.com
Word MVP web sitehttp://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Hi All
Thank for your suggestion, Why in office using Office 2003 have
"Advanced Field Properties" allow input \p switches. In my home Office
2010 without this ?


moonhkt ?
 
G

Graham Mayor

As far as I can see the insert field dialogs in Word 2003 and 2010 are
virtually indentical. They both offer the option to insert the \p switch.
However it is easy enough to toggle the field - Shift + F9 - and add the
switch. Or use CTRL+F9 and type the whole field content.
 

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