Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cheddarbug10 Cheddarbug10 is offline
external usenet poster
 
Posts: 3
Default Retaining "FileName" field after merging document

In my primary document I have a "filename" field code in the footer. After I
complete the merge, the field code becomes static. Is there a way to keep
the field code in the footer?
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Retaining "FileName" field after merging document

Well, sort of. You can
a. Put a { Filename } field into a blank document, bookmark it as fname and
save it as (say) c:\mydocs\fname.doc
b. In your mail merge main document use an

{ INCLUDETEXT "c:\\mydocs\fname.doc" fname }

c. Do the merge. The includetext survives. if you update the includetext
fields, you shoud see the file name of the container document.

The problem of course is that you are left with one or more links to an
external document. I'd probably unlink all the INCLUDETEXT fields a.s.a.p

To avoid that, I'd probably go for something more like
a. use a distinctive { PAGE } field such as
{ PAGE \#FILENAME }
b. merge
c. use Edit/Replace or a macro to display field codes and replace PAGE
\#FILENAME by FILENAME
d. update fields.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Cheddarbug10" wrote in message
...
In my primary document I have a "filename" field code in the footer.
After I
complete the merge, the field code becomes static. Is there a way to keep
the field code in the footer?


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cheddarbug10 Cheddarbug10 is offline
external usenet poster
 
Posts: 3
Default Retaining "FileName" field after merging document

Thanks for replying.

Well, the first option is a bit cumbersome. The 2nd option I've tried. The
problem I'm having is that the "merged" document has many sections and the
Find/Replace was only finding text in the current section. Any clues as to
how I can make a find/replace in footers with many sections?

Stephanie~


"Peter Jamieson" wrote:

Well, sort of. You can
a. Put a { Filename } field into a blank document, bookmark it as fname and
save it as (say) c:\mydocs\fname.doc
b. In your mail merge main document use an

{ INCLUDETEXT "c:\\mydocs\fname.doc" fname }

c. Do the merge. The includetext survives. if you update the includetext
fields, you shoud see the file name of the container document.

The problem of course is that you are left with one or more links to an
external document. I'd probably unlink all the INCLUDETEXT fields a.s.a.p

To avoid that, I'd probably go for something more like
a. use a distinctive { PAGE } field such as
{ PAGE \#FILENAME }
b. merge
c. use Edit/Replace or a macro to display field codes and replace PAGE
\#FILENAME by FILENAME
d. update fields.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Cheddarbug10" wrote in message
...
In my primary document I have a "filename" field code in the footer.
After I
complete the merge, the field code becomes static. Is there a way to keep
the field code in the footer?



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Retaining "FileName" field after merging document

I'd try a bit of VBA code as follows. See Graham Mayor's page for how to
install it:

http://www.gmayor.com/installing_macro.htm

I think this will do:

Sub UpdateAllFields()

Dim objRange As Word.Range
Dim objField As Word.Field
For Each objRange In ActiveDocument.StoryRanges
Call ProcessFields(objRange)
While Not (objRange.NextStoryRange Is Nothing)
Set objRange = objRange.NextStoryRange
For Each objField In objRange.Fields
Call ProcessFields(objRange)
Next
Wend
Next
Set objRange = Nothing
End Sub

Sub ProcessFields(objRange As Range)
Dim objField As Word.Field
For Each objField In objRange.Fields
' This has to be an exact match
If UCase(Trim(objField.Code.Text)) = "PAGE \#FILENAME" Then
objField.Code.Text = " FILENAME "
objField.Update
End If
Next
End Sub

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Cheddarbug10" wrote in message
...
Thanks for replying.

Well, the first option is a bit cumbersome. The 2nd option I've tried.
The
problem I'm having is that the "merged" document has many sections and the
Find/Replace was only finding text in the current section. Any clues as
to
how I can make a find/replace in footers with many sections?

Stephanie~


"Peter Jamieson" wrote:

Well, sort of. You can
a. Put a { Filename } field into a blank document, bookmark it as fname
and
save it as (say) c:\mydocs\fname.doc
b. In your mail merge main document use an

{ INCLUDETEXT "c:\\mydocs\fname.doc" fname }

c. Do the merge. The includetext survives. if you update the includetext
fields, you shoud see the file name of the container document.

The problem of course is that you are left with one or more links to an
external document. I'd probably unlink all the INCLUDETEXT fields a.s.a.p

To avoid that, I'd probably go for something more like
a. use a distinctive { PAGE } field such as
{ PAGE \#FILENAME }
b. merge
c. use Edit/Replace or a macro to display field codes and replace PAGE
\#FILENAME by FILENAME
d. update fields.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Cheddarbug10" wrote in message
...
In my primary document I have a "filename" field code in the footer.
After I
complete the merge, the field code becomes static. Is there a way to
keep
the field code in the footer?




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
Can we generate the footers autotext "filename and path" in Word? Antoinette Page Layout 1 June 25th 08 02:07 AM
Retaining "Personal Info" on LATER drafts (Word 2007 only) Davack Microsoft Word Help 2 July 12th 07 01:26 PM
how do I set up a "expand/collapse" or "show/hide" field in Word WordDoc_FeatureUser Microsoft Word Help 2 May 12th 07 06:29 PM
"Print current page" should have a "+n pages" field. rawahoho Microsoft Word Help 5 November 16th 06 03:26 PM
New field for Word: {SCREENTIP "DisplayText" "TipText"} DQC from Prescott AZ Microsoft Word Help 1 March 17th 06 11:29 PM


All times are GMT +1. The time now is 12:38 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"