And then I tried it in Excel 2004!

D

dr.padgett

Hello:

I have used various versions of Excel for the Macintosh to keep grades
in for the classes I teach at a small college. I was able to record a
small macro in Excel that would open the various spreadsheet files for
my classes (I keep each class in a separate file) and save that file as
a text file (tab delimited) on my desktop so that I can send the text
versions to a Web server. (There is a CGI script on that server that
allows the students to access their own grades over the Web.)

Under Excel X, an Applescript would open Excel, run the Excel macro,
quit Execl then call up Fetch and transfer the files to the Web server.
After recently upgrading to Office 2004, the Excel 2004 deals with
Applescript very differently than it did in earlier versions.

The following code used to start Excel and immediately execute the
simple macro "GBWeb" when Excel first started. (The AppleScript Editor
came up with this code!)

tell application "Microsoft Excel"
«event XCELactv»
«event XCELodoc» "My HD:Users:me:Documents:Gradebook:post GB.xls"
«event XCELmcro» "'Post GB.xls'!GBWeb()"

I've bumbled the code for Excel 2004 into:

tell application "Microsoft Excel"
activate
open workbook workbook file name "My
HD:Users:me:Documents:Gradebook:post GB.xls"

But I cannot find the code to launch the macro in that spreadsheet.


Questions:

1) How do I convince Applescript to run a macro inside an Excel 2004
spreadsheet?

2) Is a macro the best vehicle to use in this sitauation? Should I
simply ask Applescript to open then save the spreadsheet files as tab
delimited files and skip the macro inside Excel 2004? If so, how do I
write the command for this in Applescript?

While I have used Macs and Excel for a long time, this is my first
venture into the murky waters of Applescript and macros.
Thanks for your help.

//steve
 

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