![]() |
|
#5
|
||||
|
||||
|
Try the following macro:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "\<value\>*\</value\>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While .Find.Found
i = i + 1 + UBound(Split(.Text, " "))
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
MsgBox i & " words between <value> & </value> found."
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| font color, loop through all words, vba microsoft word 2013 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Count words between quotation marks
|
sojiro | Word VBA | 11 | 01-29-2017 12:59 PM |
Count number of words in closed docx files
|
Pecoflyer | Word VBA | 2 | 11-25-2016 01:07 AM |
| PNG on black background printing transparency in different tone of black | NMGMarques | Word | 0 | 03-03-2014 05:19 AM |
How can I count multiple usage of the same words?
|
coffee_king | Word VBA | 1 | 03-24-2012 07:52 PM |
Creating Text to count words WITHOUT title page
|
ingmar.s | Word | 3 | 10-08-2009 10:23 AM |