Forum Discussion
DesiMcK
Dec 05, 2022Copper Contributor
Mail Merge with HTML
Hi I have a mail merge that contains some HTML. Can anyone please advise how I replace the HTML with correct formatting? I have a sample file https://thedeanesessexschuk-my.sharepoint....
DesiMcK
Dec 06, 2022Copper Contributor
Thanks for the reply - is it possible to replace <li> with bullet points?
Thanks
Desi
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.