I need a way to make word do a word count but to not count the words that are written in the headings styles and the quote styles.
I have the following which is a starting point, but i do not know how to exclude anything, let alone styles… can it be done?
Sub Macro1()
Dim wordcount As Long
Dim myrange As Range
Set myrange = ActiveDocument.Range
wordcount = myrange.ComputeStatistics(wdStatisticWords)
MsgBox wordcount & " words"
End Sub
Thanks
Sam
Copy the contents of your document into a newly created, temporary document, run a global find/replace (Word allows to search for certain styles) and replace all headings etc. by nothing (remember to use the macro recorder if you need the VBA commands for this). Then, apply ComputeStatistics on the temporary document.