Reputation: 12077
I'm trying to set up a document for publishing to a website, so need to add some HTML tags before and after list items. However, it's not picking the list items up. Can anybody please help? Thanks.
sub format_list()
Dim para as Paragraph
Dim is_list_item as Boolean
is_list_item = False
For Each para In ActiveDocument.Paragraphs
If para.Range.ListFormat.ListType = WdListType.wdListBullet Then
is_list_item = True
para.Range.InsertBefore "<li>"
para.Range.InsertAfter "</li>"
End If
Next
End Sub
Upvotes: 0
Views: 1238
Reputation: 2013
Try using the following instead of para.Range.InsertAfter "</li>"
para.Range.Select
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:="</li>"
Upvotes: 1