Hi, I need to count specific bold text. Please suggest. ms word vba
Hi, I need to count specific bold text. Please suggest. ms word vba
You need to be more specific.
Kindly also don't resurrect ancient threads - the one you posted in was last active well over a decade ago.
Cheers
Paul Edstein
[Fmr MS MVP - Word]
What specific bold text? Count what about the bold text - the number of words, characters, something else?
Cheers
Paul Edstein
[Fmr MS MVP - Word]
For that you might use a macro like:
Sub Demo() Application.ScreenUpdating = False Dim i As Long With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = InputBox("What is the Text to Find") .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = True .Font.Bold = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found i = i + 1 .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True MsgBox i & " instances found." End Sub
Cheers
Paul Edstein
[Fmr MS MVP - Word]
Thank you so much for your help. "Figure 10-1" this text need to be count but "Figure 10-10", "Figure 10-10A" should be excluded. please advise. I need this count only "Figure 10-1".
Try changing:
.MatchWholeWord = False
to:
.MatchWholeWord = True
Cheers
Paul Edstein
[Fmr MS MVP - Word]
Hi
I tried but counting all. Please suggest
Hi Paul, what is problem here? can u suggest
In that case, you could replace all of:
with:.MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False
and input your Find expression as:.MatchWildcards = True
Figure 10\-1>
Cheers
Paul Edstein
[Fmr MS MVP - Word]
Thanks! Paul Edstein