Hi Dave,
For a single style, or just a few styles, you don't need a macro.
First go to the Tools > Options > Edit dialog and check the box for
"Keep track of formatting". Open the Styles and Formatting task pane.
Click the down arrow next to the style name (or right-click the style
name itself) and choose "Select all x instances". Then click Tools >
Word Count and read off the statistics for that style.
Writing a macro to get a word count for each style isn't quite
trivial, but it wouldn't be very difficult. The general idea is this:
The outer loop is For Each style in ActiveDocument.Styles ... Next.
Within that loop, set a Range object equal to ActiveDocument.Range,
then use that Range object's .Find to search for occurrences of the
current style. Each time it's found, use the Range object's
..ComputeStatistics(wdStatisticWords) method to get the number of words
in that occurrence and add it to a running total for the style. Keep
the results in a N x 2 array where the first column is the style name
and the second column is the final value of the running total for that
style.
If you need more guidance, ask in the
microsoft.public.word.vba.beginners newsgroup
(
http://www.microsoft.com/communitie....aspx?dg=microsoft.public.word.vba.beginners).
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
On Sun, 19 Aug 2007 16:00:02 -0700, Dave Morgan
<DaveMorgan@discussions.microsoft.com> wrote:
>Greetings, I hope that one of the VBA a wizards can say "Oh that's easy.....
>
>Q; Can I use the ComputeStatistics function to calculate the number of words
>in a document that are formated with a particular style or create a breakdown
>of words by style? ... and if so, can you please point me in the right
>direction of where to find more information.
>
>Kind Regards and thanks for your time.
>
>Dave