Show only relative path in document footer

D

DianePDavies

I am creating a big proposal with many sections and documents. I would like
to have the path+filename in every document's footer - but I would like only
to show the path of the proposal. The fact that the proposal is located in a
structure revealing the project, the country, the continent etc. is not
relevant - and takes up a lot of space in the footer.

Can I somehow subtract the first "levels" of my path before displaying what
I want to show?

I want this in many documents - so I would prefer not to have to make a VBA
function that has to be included in all documents - and as we are several
people working on the project - I cant rely on everybody having the same
normal.dot (or whereever VBA routines could be saved).
 
G

Graham Mayor

You cannot insert parts of fields, so it is not possible to do this without
vba and that vba will need to be stored in a template or add-in to which the
users have access. In the following example and the path:

D:\My Documents\Test\Versions\Odd\Temp\Test1.doc

the macro splits everything after 'Odd' thus:

\Temp\Test1.doc

Sub InsertFileNameAndPartPath()
Dim fFname() As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
fFname = Split(.FullName, "Odd")
End With
Selection.TypeText fFname(1)
End Sub

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter Jamieson

I don't particularly like it, but subject to certain constraints, you
may be able to use the approach described at

http://tips.pjmsn.me.uk/t0004.htm

For Word 2007 you would need
a. a .mdb file at the same location on everyone's drive (I like
c:\i\i.mdb because it keeps the field codes short). This can be an empty
..mdb, i.e. with no tables.

b. a nested field like

{ SET FP { DATABASE \d "c:\\i\\i.mdb" \s "SELECT 'mid('{ FILENAME \p }',
instr(1,'{ FILENAME \p }','propfolder')+len('propfolder')+1)" }

(I would put this at the beginning of the document). All the {} need to
be the special field code brace pairs that you can insert using ctrl-F9.
"propfolder" would need to be the name of the main folder in the proposal.
c. a bookmark field in your footer, e.g.

{ FP }

d. testing for a while to ensure that you don't run into Word hanging
problems before committing to the approach.

Constraints include
a. your path cannot contain single quote characters (and possibly
double quotes)
b. you may find that the result of either the database field or the FP
field starts with a paragraph mark. (see the article)
c. if you can't give everyone's .mdb the identical pathname, you will
end up having to modify files every time they move to a system with a
different pathname. You could deal with this problem by (for example)
putting both the database pathname and propfolder name in something like
Custom Document Properties, using something like

{ SET FP { DATABASE \d "{ DOCPROPERTY mdbpathname }" \s "SELECT 'mid('{
FILENAME \p }', instr(1,'{ FILENAME \p }','{ DOCPROPERTY propfoldername
}')+len('{ DOCPROPERTY propfoldername }')+1)" }

and fixing the DOCPROPERTY names as required, but that's already
becoming a high-maintenance solution.
d. you end up with a dependency on an external file that you'd
probably want to get rid of before final delivery of your proposal
e. see the article for other stuff...


Peter Jamieson

http://tips.pjmsn.me.uk
 

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