At one time, this worked perfectly. But now when I run the
appleScript I get this error.
Ambiguous name detected:TmpDDE
Any ideas or suggestions?
Thanks
Tim Whitehead
whi...@ncs.com
Have a look in your VBA Editor. You will find that you have a "temporary"
project attached to the document, named "TmpDDE". In this case you have two
of them.
I do not know whether this is because you have more than one document open,
or because Word has failed to clean it up on Quit.
Try a reboot.
Cheers
This responds to microsoft.public.mac.office.word on Thu, 5 Dec 2002
07:40:41 -0800, "Tim Whitehead" <whi...@ncs.com>:
All Spam blocked with SpamNet: a free download from http://www.cloudmark.com/
Please post all comments to the newsgroup to maintain the thread.
John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:jo...@mcghie-information.com.au
In your situation (and if this ever happens again), you can just select the
existing 'TmpDDE' module and select 'Remove TmpDDE' from the File menu in
the VBE.
George
On 12/5/02 19:55, John McGhie [MVP - Word] did expound most eloquently:
--
Mac Word FAQ: <http://www.mvps.org/word/FAQs/WordMac/index.html>
Entourage Help Page: <http://www.entourage.mvps.org/>
Or try Google: <http://www.google.com>
Please do not reply to this message. Although the email address is perfectly
valid, any replies to this account never get to the Inbox on my computer.
To avoid a similar problem a wrote a sub(Arguments as
Strings) in VBA.
Now my Applescript runs Finder and then is supposed
activate Word and run the Sub attached to the "Stationery"
document.
It goes like this:
tell application "Finder"
Set Arg1 to "apples"
Set Arg2 to "oranges"
Set arg3 to "pears"
end tell
tell application "Microsoft Word" to do Visual Basic "
ShowMyForm(" &Arg1 &"," &Arg2 &"," &Arg3 &")"
.....
end tell
Then, the new doc is supposed to open, a form would pop up
with fields already filled in and, on OK, the textboxes
pass values to the doc and it is faxed off.
MS Word seems to be utterly confused when I am trying to
pass the arguments to the macro from Applescript. What am
I doing wrong??
Help, please?
Alex
I am afraid I don't know. I do not use any AppleScript. Hopefully J.E. or
Paul will be along in a moment to tell us.
However, I am suspicious of your use of the ampersand &. In VBA that is a
sign that you want the strings concatenated. I think you need to escape
them.
Have a look at http://www.mvps.org/word/FAQs/WordMac/WordAppleScript.htm and
see if any of that helps.
Sorry
This responds to microsoft.public.mac.office.word on Tue, 10 Dec 2002
15:05:09 -0800, "Alex" <atpet...@yandex.ru>:
All Spam blocked with SpamNet: a free download from http://www.cloudmark.com/
What you want to do (i.e., pass some, I assume, user-configurable parameters
to Word) can't be done the way you're trying to do it. You can only pass
parameters to a Sub using the Call syntax, but the Sub you're calling must
be in the same module as the sub that's calling it (if that makes sense).
When you use 'do Visual Basic', a temporary module gets added to your Normal
template, and you can't use Call to access a Sub in another document.
You can use Application.Run to execute a macro that's in another document,
but then you can't pass parameters to it.
The simplest solution would really be to save the values into a text file,
say in the Temporary Items folder, in AppleScript, then have your
ShowMyForm() Sub read that file to get the values it needs. In AppleScript
you'd use 'path to temporary items folder', and append a suitable file name.
In the VBA code, you'd use 'Options.DefaultFilePath(wdTempFilePath)', using
the same file name.
Even then, if the ShowMyForm macro is not in your Normal template, you need
to (1) assure that the document ('Stationery', I assume) with that macro is
open, and (2) that document is the active document, and (3) use
Application.Run to execute it.
So you could use AppleScript to open the document (using Finder's 'open file
with' syntax), which will make it the active document. Then you would use
the syntax:
tell application "Microsoft Word"
do Visual Basic "Application.Run \"ShowMyForm\""
end tell
If the document is already open, then you don't need to open it, of course,
but you would need to assure it's the active document (see the link John
provided--it covers this in more detail).
Instead of opening the document with AppleScript, you could check (in the
VBA code you pass via 'do Visual Basic') to see if the document is already
open. If not, open it; if it is, activate it. Then you'd use Application.Run
to execute your ShowMyForm macro.
Hopefully this gives you some pointers. If you need more help, please post
back.
George
On 12/10/02 20:20, John McGhie [MVP - Word] did expound most eloquently:
--