Number of worksheet tabs and Applescript

S

sflaherty

I finally started the process of porting my VBA macros to Applescript today and ran into a lot of problems right away. Basically my VBA would take a template worksheet and then copy it multiple times with new source data as multiple worksheets within a workbook. I'm trying to narrow down the fundamental problem.

When you run the script below with Excel 2004, you end up with 41 worksheets in the workbook. In Excel 2008, you only end up with 15 (besides the fact that it takes 5-10 times longer to execute each step). Is there some new limit on the number of worksheets allowed in a workbook with Applescript? There doesn't seem to be one if add them manually from the GUI.

Thanks,
Sean

tell application "Microsoft Excel"
set display alerts to false
make new workbook

try
repeat with i from 40 to 1 by -1
copy worksheet (get worksheet "Sheet1") after (get last worksheet)
set name of last worksheet to ("new" & i)
end repeat

end try

set display alerts to true
end tell
 
Top