Pages

Monday, January 30, 2012

How to Identify and Tag Numbered Lists using VBA

How to Identify and Tag Bullet Lists using VBA

Following snippet identifies a Bulleted List and Tags all Bullet List items and the Bulletted List as a whole

Sub Tag_Lists()

Dim oBL As ListFormat
Dim oList As List
Dim oLI

    For Each oList In ActiveDocument.Lists
        If oList.Range.ListFormat.ListType = WdListType.wdListBullet Then
            For Each oLI In oList.ListParagraphs
                oLI.Range.InsertBefore "
  • " oLI.Range.InsertAfter "
  • " Next oLI oList.Range.InsertBefore "
      " oList.Range.InsertAfter "
    " End If Next oList End Sub

    No comments:

    Post a Comment