asked on
Sub Count()
Dim l As Long
ResetSearch
With ActiveDocument.Range.Find
.Style = "Strong" 'Replace with the name of the style you are counting
While .Execute
l = l + 1
If l > ActiveDocument.Range.Paragraphs.Count Then
Stop
End If
Wend
End With
MsgBox l
ResetSearch
End Sub
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
' plus some more if needed
.Execute
End With
End Sub