tell application "Microsoft Word"
do Visual Basic "Documents.Open \"Macintosh Hard Disk:Applications:Microsoft Office X:Templates:My Templates:Special Template.dot\"
Application.Run \"Module1.MyProcedure\""
end tell
I have to add a Word Template i.e., “Test.dot” from one particular path and to run a “For_Test” Macro from that Template in an active document. Can anyone help me.
I’ve had a quick look at the dictionary, for Word 2011, and it looks like ‘do Visual Basic’ isn’t there.
If I replace it with ‘do script’ that line compiles.
It looks like the script you’ve found might be for an earlier version of Word.
Maybe I’m a bit late in replying, but the syntax you need is
tell application "Microsoft Word"
add addin file name (pathVar & msWordTemplateLocation) with install
end tell
where pathVar is the path to the home folder and msWordTemplateLocation is the path to the Word template, i.e. Library:Application Support:Microsoft:Office:User Templates:template_name.dotm