Word - find and replace for a bullet list to html tagged style list

Asked By Liam on 29-May-12 12:06 AM
I am wanting a macro to find instances of bullet lists, and replace it
with a html tagged list. Please see below for an example:

**my_doc.docx**
...

text,text,text
My bullet list:
=95 List point one
=95 List point two
Some more text here.

...

A find and replace resulting in

...

text,text,text
My bullet list:
Some more text here.
...

Does anyone know of a way to do this? I have tried looking for the
bullet characters; does not work as it is formatting. Tried looking for
lines with style "List bullet" and any other lists i can find; does not
work, I do not know why.


Liam replied to Liam on 29-May-12 03:32 AM
Anyways I found another script to iterate through each line of the
document and add to a counter. Do you know if there would be a way to
append to the found paragraph <li> tags on either end... something
like below???


Sub FindBullet()
Dim oPara As Word.Paragraph
Dim count As Integer

count =3D 0
Selection.WholeStory
With Selection
For Each oPara In .Paragraphs
If oPara.Range.ListFormat.ListType =3D _
WdListType.wdListBullet Then

count =3D count + 1


With ActiveDocument.Range.Find
.Text =3D #How do i convert the oPara to a string here?!?
.Forward =3D True
.Wrap =3D wdFindContinue
.Format =3D False
.MatchCase =3D True
.MatchWholeWord =3D False
.MatchWildcards =3D False
.MatchSoundsLike =3D False
.MatchAllWordForms =3D False

.ClearFormatting
With .replacement
.ClearFormatting
.Text =3D # how do i specify this is where i want the "<li>" & oPara &
End With
.Execute Replace:=3DwdReplaceAll

End If
Next
End With
'Gives you the count of bullets in a document
MsgBox count & " replacements"
End Sub