Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Rose M
 
Posts: n/a
Default How do I change footer to only show 1 level of path and file name

I want to put footer on a document (word and excel) but I only want to show
one level of the path and file name. ex: C:\...\folder\file name. The
choices in the list only give path and file or file name. Path and file name
is too long. Ex: C:\Documents and Settings\Owner\My Documents\folder
name\file name. C:\folder name\file name is sufficient.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M -WordMVP-
 
Posts: n/a
Default How do I change footer to only show 1 level of path and file name

Hi ?B?Um9zZSBN?=,

I want to put footer on a document (word and excel) but I only want to show
one level of the path and file name. ex: C:\...\folder\file name. The
choices in the list only give path and file or file name. Path and file name
is too long. Ex: C:\Documents and Settings\Owner\My Documents\folder
name\file name. C:\folder name\file name is sufficient.

there is no built-in option for what you want. You'd need to use a macro
solution, which could get a bit complicated if the path needs to update whenever
the document is opened and/or saved.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom
 
Posts: n/a
Default How do I change footer to only show 1 level of path and file name

If the problem is that the full path takes up too much space in your
footer, you could simply decrease the font size of the Footer
paragraph style.

Alternatively, you can use the macro below which provides a
semi-automatic way to create paths of the type
"C:\..\folder\filename". The macro creates a document variable named
CustomPath (if necessary). If a file has been moved to a different
location, just run the macro again to update the value of CustomPath.

To display the value of CustomPath in your document you would use the
field { DOCVARIABLE "CustomPath" }. To insert this field, press
CTRL+F9, type DOCVARIABLE "CustomPath" between the field delimiters,
and press F9.

After you've updated the value of the doc variable (by using the
macro), you can switch to Print Preview which will force an update of
the field.

Sub DetermineCustomPath

Dim FullPath As String, Temp As String
Dim Pos1 As Long, Pos2 As Long
Dim RootFolder As String
Dim TheResult As String
Dim v As Variable

FullPath = ActiveDocument.Path

Pos1 = InStr(FullPath, "\")
RootFolder = Left(FullPath, Pos1)

Temp = StrReverse(FullPath)
Pos2 = InStr(Temp, "\")
TheResult = Right(FullPath, Pos2)

For Each v In ActiveDocument.Variables
If v.Name = "CustomPath" Then
v.Value = RootFolder & ".." & TheResult & "\" & _
ActiveDocument.Name
Exit Sub
End If
Next v
ActiveDocument.Variables.Add "CustomPath", RootFolder & ".." & _
TheResult & "\" & ActiveDocument.Name

End Sub

--
Stefan Blom
Microsoft Word MVP


"Rose M" wrote in messsage
...
I want to put footer on a document (word and excel) but I only want

to show
one level of the path and file name. ex: C:\...\folder\file name.

The
choices in the list only give path and file or file name. Path and

file name
is too long. Ex: C:\Documents and Settings\Owner\My

Documents\folder
name\file name. C:\folder name\file name is sufficient.











  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom
 
Posts: n/a
Default How do I change footer to only show 1 level of path and file name

Hmm, I just realized that the code in my previous reply doesn't
consider the case when a file is located in a root folder, such as
C:\. The code below does, which improves things a bit (but there are
other special situations that should be taken care of).

Note: If you need help with installing the macro, see:
http://gmayor.com/installing_macro.htm.

'Modified code example:
Sub DetermineCustomPath2
Dim FullPath As String, Temp As String
Dim Pos1 As Long, Pos2 As Long
Dim RootFolder As String
Dim TheResult As String
Dim v As Variable

FullPath = ActiveDocument.Path

Pos1 = InStr(FullPath, "\")
If Pos1 = 0 Then
TheResult = ActiveDocument.FullName
Else
RootFolder = Left(FullPath, Pos1)

Temp = StrReverse(FullPath)
Pos2 = InStr(Temp, "\")
TheResult = Right(FullPath, Pos2)
TheResult = RootFolder & ".." & TheResult & "\" & _
ActiveDocument.Name
End If
For Each v In ActiveDocument.Variables
If v.Name = "CustomPath" Then
v.Value = TheResult
Exit Sub
End If
Next v
ActiveDocument.Variables.Add "CustomPath", TheResult

End Sub

--
Stefan Blom
Microsoft Word MVP


"Stefan Blom" skrev i meddelandet
...
If the problem is that the full path takes up too much space in your
footer, you could simply decrease the font size of the Footer
paragraph style.

Alternatively, you can use the macro below which provides a
semi-automatic way to create paths of the type
"C:\..\folder\filename". The macro creates a document variable named
CustomPath (if necessary). If a file has been moved to a different
location, just run the macro again to update the value of

CustomPath.

To display the value of CustomPath in your document you would use

the
field { DOCVARIABLE "CustomPath" }. To insert this field, press
CTRL+F9, type DOCVARIABLE "CustomPath" between the field delimiters,
and press F9.

After you've updated the value of the doc variable (by using the
macro), you can switch to Print Preview which will force an update

of
the field.

Sub DetermineCustomPath

Dim FullPath As String, Temp As String
Dim Pos1 As Long, Pos2 As Long
Dim RootFolder As String
Dim TheResult As String
Dim v As Variable

FullPath = ActiveDocument.Path

Pos1 = InStr(FullPath, "\")
RootFolder = Left(FullPath, Pos1)

Temp = StrReverse(FullPath)
Pos2 = InStr(Temp, "\")
TheResult = Right(FullPath, Pos2)

For Each v In ActiveDocument.Variables
If v.Name = "CustomPath" Then
v.Value = RootFolder & ".." & TheResult & "\" & _
ActiveDocument.Name
Exit Sub
End If
Next v
ActiveDocument.Variables.Add "CustomPath", RootFolder & ".." & _
TheResult & "\" & ActiveDocument.Name

End Sub

--
Stefan Blom
Microsoft Word MVP


"Rose M" wrote in messsage
...
I want to put footer on a document (word and excel) but I only

want
to show
one level of the path and file name. ex: C:\...\folder\file

name.
The
choices in the list only give path and file or file name. Path

and
file name
is too long. Ex: C:\Documents and Settings\Owner\My

Documents\folder
name\file name. C:\folder name\file name is sufficient.
















  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default How do I change footer to only show 1 level of path and file name

My fellow MVPs have offered solutions based on what you have, but don't
overlook the obvious. Move your Word documents folder to a folder directly
off the root eg C:\Foldername (Tools options file locations Documents)
and you won't have a long path to deal with

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Rose M wrote:
I want to put footer on a document (word and excel) but I only want
to show one level of the path and file name. ex: C:\...\folder\file
name. The choices in the list only give path and file or file name.
Path and file name is too long. Ex: C:\Documents and
Settings\Owner\My Documents\folder name\file name. C:\folder
name\file name is sufficient.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File path of sub in footer of master snoopy Formatting Long Documents 1 September 6th 05 08:28 PM
How to creat relative and shorthand file path names? 2dogs Microsoft Word Help 1 May 15th 05 12:11 PM
Adding the path and file name to the footer of my Normal.dot and . Eddie in the Ocean. Microsoft Word Help 1 March 31st 05 06:26 PM
Possible to set up default footer with file and path name? Ian Page Layout 4 March 21st 05 02:59 PM
file name and path footer? Legal Learning Microsoft Word Help 0 January 20th 05 04:25 PM


All times are GMT +1. The time now is 08:55 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"