OK, I’m not sure that Panther is the culprit, but after some experimenting I’ve narrowed it down to a few variables.
This simple script works in Jaguar (returns the name of the worksheet) but fails on Panther (Script Debugger displays error -1728, Microsoft Excel got an error: Can’t get Name of Worksheet 1.
tell application “Microsoft Excel”
name of worksheet 1
Works on a Jaguar System but fails on Panther.
Excel v.X service release one in both cases.
Instead of having “Name of Worksheet 1,” write “Name of document 1”
Although not specific to this issue I’ve found Panther a lot pickier about making sure you have the proper type. For instance sometimes when scripting in the Finder I’ve had to specify types such as “folder” or “file” where they were assumed before.
Name of document 1 gives the same sort of error on Panther, but works on Jag. In any case, I’m actually trying to get the worksheet name (as named on the tab at the bottom of the document window, not the document name.
Excel is a little quirky. Try this:
tell application "Microsoft Excel"
return Name of (get Worksheet 1)