0

Is there an AppleScript command which will grab the word count of the currently open Microsoft Word® document?

  • 1
    do you specifically need an Applescript method for inclusion in something else or do you just need to count words in MS Word? Also it would be good to edit your question (also) with what version(s) you need it to work with. – Steve Chambers May 31 at 19:06
1

Yes. You could use this:

tell application "Microsoft Word"
    set theDoc to document 1
    return document property "Number of words" of theDoc
end tell

Since you asked for the word count of "the currently open Microsoft Word® document" this does it. This script works ONLY in the case where you have a single Word document open.

It works for Word 2011 and for Word 16.25 (from Office 365).

  • Why set theDoc to document 1? It just seems needless when you could have just used, return document property "Number of words" of document 1 being direct and to the point with less code. – user3439894 Jun 2 at 2:45
  • Of course, you're right. Good point. – Christian Boyce Jun 2 at 5:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .