View Single Post
  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Mail Merge & Find/Replace

With the following insertion into the code in the Private Sub
app_MailMergeAfterMerge(ByVal Doc As Document, ByVal DocResult
As Document) event,

NewDoc.Range.Fields.Update
'Begin insert
With NewDoc
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="CR", Replacewith:="^l",
MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
End With
'End insert
NewDoc.SaveAs FldrPath & fnames(i)

When I execute a mailmerge main document containing a table with each cell
containing:

The quick brown fox jumps over the lazy dog.CRThe quick brown fox jumps
over the lazy dog.CRThe quick brown fox jumps over the lazy dog.CRThe
quick brown fox jumps over the lazy dog.CRThe quick brown fox jumps over
the lazy dog.

to a new document, and make use of the add-in, the contents of the each cell
in the resulting documents created by the add-in become:

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

So it certainly works.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"what4893" wrote in message
oups.com...
I'm using the Word Add-In Template. It is a .dot file with the macro
for the mail merge built in. The macro intercepts the mail merge call
from Word and uses his code to perform the merge. Thanks again for your
help.