AppleScript with Excel 2004

D

Dave Kelly

My AppleScripts I used with Excel X have broken. Where can I find some
sample AppleScript code for working with Excel 2004???
 
J

Jim Gordon MVP

Hi Dave,

You are correct - many Applescripts will need to be modified to run in Excel
2004 because the scripting capabilities have vastly improved.

Did you try dropping the Excel icon onto the Applescript Editor's icon to
see the new library?

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.
 
W

WJ Shack

Two changes I noticed when updating my AS from X to 2004 were in the calls
to VB macros. In X it is "Evaluate", in 2004 it is " run VB macro". In X
you could get away with statements like "set x to the value of cell("n6");
in 2004 you have to write as "set x to (get value of cell("n6").
 
B

Bill

Have you been able to substitute the column index for the column
letter?
i.e.:
set the_first_col to the first column index of selection
set this_new_filename to value of cell ("R3C" & the_first_col + 1) of
active sheet

Please see my post at
http://groups.google.com/[email protected]

All I want to do is be able to reference a dynamic column ... not
hardcode column "n" or similar.

Thanks
 
T

Tom B

I have quite a few AppleScripts written for Excel. For the most part I have
been able to correct the problem in the script. One thing I can not figure
out is how to get the MacScipt function to run from a button. I use it all the
time in v.X. What changed? Is there ANY documentation that describes the
changes. I can read the AppleScript dictionary, but running the
MacScript function from the Excel macro has changed and I can not figure it
out. HELP please!
Tom
 
J

JE McGimpsey

Tom B said:
I have quite a few AppleScripts written for Excel. For the most part
I have been able to correct the problem in the script. One thing I
can not figure out is how to get the MacScipt function to run from a
button. I use it all the time in v.X. What changed? Is there ANY
documentation that describes the changes. I can read the AppleScript
dictionary, but running the MacScript function from the Excel macro
has changed and I can not figure it out. HELP please!

MacScript can certainly be run from a button in XL04 (I do it regularly).

What code are you having problems with?
 
T

Tom Bilski

I tried several things on two different machines, a G4 running 10.2.8 and a
G5 running 10.3.5.
Both of the following set of codes give me the same error.

1) For this purpose I wrote an AppleScript that simply puts up a dialog box.
This script runs fine when doubled clicked. When the AppleScript named
"Test" (saved as an application) is in the same folder as the Excel Workbook
the code is:

sub NewWeek()
MacScript ("Test")
End Sub

2) When the same script is put in a folder that is not the same as the
Workbook the code is:

sub NewWeek()
MacScript ("Macintosh HD:Test folder:Test")
End Sub

It is very basic code. I get the same error "Run-time error '5': Invalid
procedure call or argument."

Any ideas what I'm doing wrong?
Tom
 
B

Bernard Rey

Tom Bilski wrote :
.../... When the AppleScript named
"Test" (saved as an application) is in the same folder as the Excel
Workbook the code is:

sub NewWeek()
MacScript ("Test")
End Sub

.../...

It is very basic code. I get the same error "Run-time error '5': Invalid
procedure call or argument."

Any ideas what I'm doing wrong?

Make sure the "real" name of your AppleScript isn't "Test.scpt": check it
with "Get info" (Command-I). It requires the full name (and it did the trick
for me)...
 
T

Tom Bilski

Bernard,
I saved the script as a "compiled script" and added the extension ".scpt".
Now it works perfectly.
Thank you for the help. :)
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top