• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: do visual basic
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: do visual basic (From: Michael Grant <email@hidden>)

  • Prev by Date: Re: do visual basic
  • Next by Date: Re: do visual basic
  • Previous by thread: Re: do visual basic
  • Next by thread: New to AS... What am I doing wrong?
  • Index(es):
    • Date
    • Thread