Applescript for inserting comments in Word 2008

I recently upgraded to Office 2008, and while I like many features, the omission of VBA is not one of them.

I'm a teacher who grades papers electronically using the insert comments feature in Word. As you might imagine, I make a lot of the same statements over and over (and over and over). In Office 2004 (which I must use until I gain facility with Applescript), it was easy to record a macro. Obviously, that's no longer an option.

I'm trying to learn basic scripting language, but it's daunting for someone who's never done it before. Can someone tell me what would be involved in an Applescript that tells Microsoft Word to insert a comment with a particular comment?

Thank you.

Macbook (2 gig RAM; 160 gig HD); 20" iMac Core Duo (2 gig RAM; 250 gig HD), Mac OS X (10.4.8), OWC 250 gig External Drive; OWC External DVD/CD Burner

Posted on Apr 17, 2008 2:15 PM

Reply
4 replies

Apr 21, 2008 6:19 PM in response to SmokinHalfNote

Hello

Firstly, I don't use MS Word for myself and I cannot provide anything but educated guesses on Word scripting.
Now, you might try something as follows to insert a Word comment into the current selection.

--SCRIPT1
tell application "Microsoft Word"
make new Word comment at selection with properties {author:"your mentor", comment text:"review this"}
end tell
--END OF SCRIPT1

OR

--SCRIPT2
tell application "Microsoft Word"
collapse range text object of selection direction collapse end
make new Word comment at selection with properties {comment text:"review this"}
end tell
--END OF SCRIPT2

SCRIPT2 is the same code as given in p.192 of 'Word 2004 AppleScript Reference' (pdf) which you can obtain via the links listed below. But, if I'm not mistaken, collapsing the text range of a selection in advance is not required to make new Word comment at the selection. (I may be wrong of course).

cf.
For Word scripting:
http://www.microsoft.com/mac/developers/default.mspx
Word 2004 AppleScript Reference (pdf)

For AppleScript:
http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScriptLangG uide/
AppleScriptLanguageGuide.pdf

Hope this may be of some help.
H

Message was edited by: Hiroto (fixed typo)

Apr 27, 2008 3:14 PM in response to Hiroto

This works great for me, I can use this script to insert a comment using MacSpeech Dictate. I have one other question, though. How do you tell AppleScript to put the cursor in the comment box? This script leaves the cursor in the text, which is still then requires a mouse operation to dictate the comment in the text box. Thanks in advance for your help.

Joe

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Applescript for inserting comments in Word 2008

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.