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

    Share on Facebook
    Related Posts Plugin for WordPress, Blogger...

    Visual Basic for Applications (VBA) Forum (recent threads)

    CodeKeep VBA Feed

    Visual Studio Tools for Office Forum (recent threads)

    Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

    Office Business Applications (OBA) Team Blog

    MSDN Code Gallery Published Resources For Tag VSTO Google Group