Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
I have a client who wants to use the path to and filename of a word
document as its reference but wants to use part of the file path not all of it. so the reference for c:\my documents\folder1\folder2\doc1.doc should be ..folder1\folder2\doc1.doc If I use field codes I either get all of the path or none of it. Can anyone suggest a way to do what my client wants? Many thanks. |
#2
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
It can't be done with fields. You will need a macro. Something along the
lines of Sub InsertPartPath() Dim fPath As String Dim intPos As Integer With ActiveDocument If Len(.Path) = 0 Then .Save End If fPath = .FullName MsgBox fPath intPos = InStr(4, fPath, "\") MsgBox intPos fPath = ".." & Right(fPath, Len(fPath) - intPos + 1) MsgBox fPath End With End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org wrote: I have a client who wants to use the path to and filename of a word document as its reference but wants to use part of the file path not all of it. so the reference for c:\my documents\folder1\folder2\doc1.doc should be ..folder1\folder2\doc1.doc If I use field codes I either get all of the path or none of it. Can anyone suggest a way to do what my client wants? Many thanks. |
#3
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
On 17 Jul, 06:09, "Graham Mayor" wrote:
It can't be done with fields. You will need a macro. Something along the lines of Sub InsertPartPath() Dim fPath As String Dim intPos As Integer With ActiveDocument If Len(.Path) = 0 Then .Save End If fPath = .FullName MsgBox fPath intPos = InStr(4, fPath, "\") MsgBox intPos fPath = ".." & Right(fPath, Len(fPath) - intPos + 1) MsgBox fPath End With End Sub http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web sitewww.gmayor.com Word MVP web sitehttp://word.mvps.org wrote: I have a client who wants to use the path to and filename of a word document as its reference but wants to use part of the file path not all of it. so the reference for c:\my documents\folder1\folder2\doc1.doc should be ..folder1\folder2\doc1.doc If I use field codes I either get all of the path or none of it. Can anyone suggest a way to do what my client wants? Many thanks.- Hide quoted text - - Show quoted text - Thanks, I will try and post bak the result. |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
In Word 2007, how do I insert the filename and path in the footer? | Microsoft Word Help | |||
filename and path in a footer in 2007 beta 2? | Microsoft Word Help | |||
Word 2007 Footer - Path and Filename | Microsoft Word Help | |||
Filename and Path Field Codes | Microsoft Word Help | |||
Update field codes automatically, such as filename/path. | Mailmerge |