Unable to identify HTML tag unordered list paragraph and replace with custom style bullets

53 views Asked by At

I'am trying to find a way to replace or insert Bullets to the unordered list paragraph.I have achieved it in few instances where the HTML unordered bullet list is tagged correctly in the word paragraph.But in the below mentioned paragraph it's not working.

"[ul][li]Thank them and let them know that the company takes their concerns very seriously. [/li][li]We have formal process in place which has to be followed. [/li][li]they can report their concerns to the ethical team available, including:[/li][ul][li]ethical Team[/li][li]Ethics HelpLine, anonymously if preferred [/li][li]this is considered as risk confirmed[/li][/ul][/ul]"

Below are the two sub procedures for [ul] and [li] which will work sometime, however it is not working for the above paragraph.

Sub ullist()
Application.ScreenUpdating = False
Call Copy_styles
Set objWord = GetObject(, "Word.Application")

   objWord.Visible = True

With ActiveDocument.Range.Find

  .ClearFormatting
  .Replacement.ClearFormatting
  .Replacement.Style = "List Spacing 3"
  .Text = "\[ul\](*)\[/ul\]^13"
  .Replacement.Text = "\1^p"
  .Forward = True
  .Format = True
  .Wrap = wdFindContinue
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
  '.ParagraphFormat.FirstLineIndent = InchesToPoints(0.25)
 
End With
Application.ScreenUpdating = True
End Sub

Sub lilist()
Application.ScreenUpdating = False
Call Copy_styles
Set objWord = GetObject(, "Word.Application")

   objWord.Visible = True

With ActiveDocument.Range.Find

  .ClearFormatting
  .Replacement.ClearFormatting
  .Replacement.Style = "List Spacing 3"
  .Text = "\[li\](*)\[/li\]^13"
  .Replacement.Text = "\1^p"
  .Forward = True
  .Format = True
  .Wrap = wdFindContinue
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
 
End With
Application.ScreenUpdating = True
End Sub

Please correct me with the script mentioned above for both [ul] and [li] and replace [ul] and [li] with list paragraph bullets

0

There are 0 answers