A
andreas
Dear Experts:
below macro counts the number of occurrences of bold formatting in a
document. It is running fine on documents WITHOUT tables. As soon as
there is a BOLD FORMATTED WORD within a TABLE, the macro falls into an
endless loop.
How do I have to change the code to include also tables?
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub CountNumber_FindOperation
Dim rngStory As range
Dim i As Long
Set rngStory = ActiveDocument.StoryRanges(wdMainTextStory)
With rngStory.Find
.Font.Bold = True
While .Execute
i = i + 1
Wend
End With
If i > 0 Then
MsgBox "Occurrences of bold formatting found " & i & " time(s)."
Else
MsgBox "No bold formatting found", vbOKOnly, "No bold formatting!"
End If
End Sub
below macro counts the number of occurrences of bold formatting in a
document. It is running fine on documents WITHOUT tables. As soon as
there is a BOLD FORMATTED WORD within a TABLE, the macro falls into an
endless loop.
How do I have to change the code to include also tables?
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub CountNumber_FindOperation
Dim rngStory As range
Dim i As Long
Set rngStory = ActiveDocument.StoryRanges(wdMainTextStory)
With rngStory.Find
.Font.Bold = True
While .Execute
i = i + 1
Wend
End With
If i > 0 Then
MsgBox "Occurrences of bold formatting found " & i & " time(s)."
Else
MsgBox "No bold formatting found", vbOKOnly, "No bold formatting!"
End If
End Sub