> Do you know of a way to have it run automatically for each
> merged document? Right now I'm having to run it manually (which is still a
> step forward, at least).
I would probably create a macro that perforrmed the merge /then/ did the
find/replace. e.g.
Sub MergeThenReplace()
Dim objMMMD As Word.Document 'Mail Merge Main Document
' After the merge, the new document becomes the active document
' So make a reference to the activeDocument in case we
' need to refer to it post-merge (although in this case, we don't)
Set objMMMD = ActiveDocument
With objMMMD.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Style = ActiveDocument.Styles("Heading 3")
.Replacement.ParagraphFormat.Borders.Shadow = False
.Text = "\<h3\>(*)\</h3\>"
.Replacement.Text = "\1"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Set objMMMD = Nothing
End Sub
Peter Jamieson
> Hi Peter,
>
[quoted text clipped - 29 lines]
> Selection.Find.Execute Replace:=wdReplaceAll
> End Sub
Brendan - 04 May 2007 20:15 GMT
Hi Peter,
Thank you so much for your help!
Your script worked very well. Unfortunately my master document was full of
section breaks for formatting and I haven't found a way to fully adapt it, so
we'll still be doing some extra work. But again, thank you for your help.
Much appreciated.
Brendan
> > Do you know of a way to have it run automatically for each
> > merged document? Right now I'm having to run it manually (which is still a
[quoted text clipped - 79 lines]
> > Selection.Find.Execute Replace:=wdReplaceAll
> > End Sub