Re: do visual basic
Re: do visual basic
- Subject: Re: do visual basic
- From: David wignall <email@hidden>
- Date: Thu, 11 Mar 2004 20:35:20 +1300
Resent to the list. Sorry Michael, my machine is in the shop and I don't
have the MLM set up one this one...
On 11/3/2004 3:23 PM, "Michael Grant" <email@hidden> wrote:
>
Do any of you folks happen to know offhand the VBA code to get a Word
>
document's full wordcount?
You could use
Sub basComputeWords()
Dim x As Long
x = ActiveDocument.ComputeStatistics(wdStatisticWords, True)
MsgBox x
End Sub
But that doesn't get headers and footers and generally isn't worth the bits
it's printed on (the True means include footnotes and end notes). Otherwise
Sub basBetterWordCount()
Dim x As Long
Dim rngStory As Range
For Each rngStory In ActiveDocument.StoryRanges
x = x + rngStory.Words.Count
Next rngStory
MsgBox x
End Sub
This gets everything including punctuation and pilcrows, which may or may
not be what you want. If not then you would have to test each word for
validity. Exasperating, isn't it.
--
Dave
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.