Kamran
Kamran

Reputation: 4100

Count number of bullets in Active word Documents VBA

I am using this code to count number of bullets in word documents. But its always returning zero.

Sub FindBullet()

Dim oPara As Word.Paragraph
Dim count As Integer
count = 0

'Select Entire document
Selection.WholeStory

With Selection
    For Each oPara In .Paragraphs
        If oPara.Range.ListFormat.ListType = WdListType.wdListBullet Then

            count = count + 1

        End If
    Next
End With

'Gives the count of bullets in a document
MsgBox count

End Sub

Upvotes: 1

Views: 913

Answers (1)

VKC
VKC

Reputation: 16

Well, I just opened up a blank Word doc, popped the code in and ran it, and it is returning however many bullets I put in. I did not modify your code...

Could your bullets really be something else, like a numbered list or some other symbol?

Upvotes: 0

Related Questions