Forum Discussion
Mail Merge with HTML
DesiMcK Is the Sample file that you provided the result of the mail merge, or is it intended to be the data source
If you do not need the underlining as shown for Band B below, you could obtain that result by first using a couple of ordinary Find and Replace routines, one to replace
</p>
with
^p
and the other to replace
</li>
with
^p
and (Note, there is a splace after the "</li> "
Then use a Wildcard replace to replace
\<[a-z\/]{1,}\>
with nothing
If you want the underlining, it would require the use of a macro and a more complex replace routine, but it might be simpler just to perform the replaces detailed above and then manually select the text taht is to be underlined and apply the underlining
Thanks
Desi
- Dec 06, 2022
DesiMcK I am do not know how big the document is, but if it's not too big, it would just be simpler to select the paragraphs and manually apply bulleting (rather than the underlining.
- DesiMcKDec 06, 2022Copper ContributorHi
the doument is about 50 pages and I need to run it 6 times per year. I was hoping for a quick, reuseuable way to do it.
Desi- Dec 06, 2022
DesiMcK Define a new style with the name of ListBullet that has the format that you require for the bulleted paragraphs and then use a macro with the following code
Dim i As Long, j As Long, p As Long With Selection .HomeKey wdStory With .Find .MatchWildcards = False .Text = "</p>" .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll End With End With With Selection .HomeKey wdStory With .Find .MatchWildcards = False .Text = "</li> " .Replacement.Text = "^p" .Execute Replace:=wdReplaceAll End With End With With Selection .HomeKey wdStory With .Find .MatchWildcards = True .Text = "\<[a-z\/]{1,}\>" .Replacement.Text = "" .Execute Replace:=wdReplaceAll End With End With With ActiveDocument.Tables(1) For i = 1 To .Rows.Count With .Rows(i) For j = 1 To .Cells.Count With .Cells(j) If .Range.Paragraphs.Count > 1 Then For p = 2 To .Range.Paragraphs.Count With .Range.Paragraphs(p) If .Range.Characters.Count > 10 Then .Style = "ListBullet" End If End With Next p End If End With Next j End With Next i End WithThe attached file was processed by running that macro.