Re: Calling Word macro's/VB script in word
Re: Calling Word macro's/VB script in word
- Subject: Re: Calling Word macro's/VB script in word
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 19 Sep 2002 14:37:49 -0700
On 9/19/02 1:24 PM, "Kinsella, John R." <email@hidden> wrote:
>
In order to facilitate the HTMLcode changes I'm making, I have to tell word
>
to show the active document in HTML Source mode. I found the easiest way to
>
do this was to record a macro, and then have the applescript call that by
>
the following method
>
Tell application "word"
>
Do visual basic "WordBasic.ViewTHMLSource"
>
End tell
>
>
Now, this works flawlessly for the first document that the folder action
>
scans. It changes the view, runs through the search and replace, and then
>
closes the document. It then opens the next document, and when it trys to
>
run that command, I get a
>
"Microsoft Word got an error: " WordBasic.ViewTHMLSource" doesn't understand
>
the do Visual Basic message."
>
>
So, it works once, and then fails with the next document. Any idea's as to
>
why?
That's not the right way to do it. WordBasic is long deprecated, although it
sometimes works like that, sort of. What version of Word are you using here?
5.1? Can't be if you have 'do Visual Basic'. Recording macros may still use
it (and a few dialogs), but you need proper VBA. 'do Visual Basic' is meant
to be used with VBA, not WordBasic. You should find out: use the VB Editor
to find out what the equivalent VBA command is, and use that, not the
WordBasic. version. You will probably need to refer somewhere to the front
document, which is always 'ActiveDocument'.
--
Paul Berkowitz
_______________________________________________
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.