No. 'do Visual Basic' can certainly be run from any external AppleScript at
any time, but there's no way to attach a script to a document such that it
runs automatically when you open the document. I suppose you could set up a
stay-open applet (in ~/Startup Items) that was always open and running an
idle handler every few seconds to check whether Word was running and if
specific named documents existed (i.e. were open), and if so, to do
something. But this is much, much clunkier than a macro "embedded" in the
document itself triggered from an AutoExec macro on open.
I don't think that even a Folder Action in the Finder would work here (I
haven't use them much). Attached to the folder containing the document, it
would only notice if you added a new doc, or removed one, or maybe re-saved
one, not if you opened a doc.
The problem is not with sending Word commands, it's with knowing when to
send them. There's no way to attach an AppleScript to a document that is
triggered by an Open event, as you can with AutoExec VBA macros. It's the
one limitation of AppleScript - but a carefully considered one, I think.
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.