Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] ollyaitch@gmail.com is offline
external usenet poster
 
Posts: 1
Default filename and path field codes in Word 2007

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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default filename and path field codes in Word 2007

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   Report Post  
Posted to microsoft.public.word.docmanagement
OllyAitch OllyAitch is offline
external usenet poster
 
Posts: 1
Default filename and path field codes in Word 2007

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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In Word 2007, how do I insert the filename and path in the footer? MLB Microsoft Word Help 2 June 15th 07 02:17 AM
filename and path in a footer in 2007 beta 2? activesinger Microsoft Word Help 3 April 9th 07 03:20 AM
Word 2007 Footer - Path and Filename dslocum Microsoft Word Help 2 March 8th 07 09:42 PM
Filename and Path Field Codes Sue's Blues Microsoft Word Help 1 January 15th 07 07:19 PM
Update field codes automatically, such as filename/path. jstogryn Mailmerge 1 March 25th 05 10:22 PM


All times are GMT +1. The time now is 10:28 AM.

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"