Hi there,
I’m a bit of an applescript beginner, but have done a few searches both of this site and the internet and havent come up with a solution.
I have written a snippet of applescript code that will allow me to convert a windows excel .xlsm file to a .xlsx file. It works fine on a single file.
tell application "Microsoft Excel"
activate
set the_file_path to path to desktop as text
set sheetname to name of active sheet
save workbook as active workbook filename the_file_path & sheetname & "-new.xlsx" file format Excel XML file format
end tell
That was fine. It works well when an Excel workbook is pre-opened. What I wanted to do was do it for a batch of files. I thought the best way was to create a droplet. So I read a tutorial or 2 and came up with:
on open theFiles
tell application "Microsoft Excel"
activate
repeat with afile in theFiles
set the_file_path to path to desktop as text
set sheetname to name of active sheet
save workbook as active workbook filename the_file_path & sheetname & "-new.xlsx" file format Excel XML file format
end repeat
end tell
end open
But that code doesn’t work saying that Excel doesn’t understand the “event smXLsSwA message”. What am I doing wrong?
Anyone have any ideas?
Thanks,
Will
Model: Macbook 13" 2.0Ghz Core duo
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)