AppleScript Page Setup and Paper Size

M

msuwigwam

Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Hello,

I have been beating my head into the wall to figure this one out. I have created the following AppleScript to set some items in the Page Setup:

tell application "Microsoft Excel"
        tell page setup object of active sheet
                set page orientation to landscape
                set zoom to false
                set fit to pages wide to 1
                set fit to pages tall to 9999
        end tell
end tell

So that seems to work. The problem is I need to also be able to change the Paper Size using AppleScript as well. To change it in the GUI, I go to File... Page Setup... Options... {change the paper size to whatever you want} then click OK, OK

Is changing the Paper Size via AppleScript possible?

Instead of AppleScript, I have tried both Automator and QuicKeys... both seem to have trouble with the deeper Page Setup menu (Page Setup... click Options... to get to another Page Setup window).

It seems like Word 2008 has a way to change the paper size via AppleScript, but I'm starting to think it is impossible in Excel 2008.

Thanks for your help!
 
M

msuwigwam

Just for future people's FYI (since I had no replies)... I ended up just using QuicKeys (http://www.startly.com/products/quickeys/mac/4/)

The way I got it to work, was I didn't start recording the QuicKeys shortcut (macro) until I had the second Page Setup dialog box open (File, Page Setup..., Options...). Then after I had all of the steps after that diaglog box recorded, I just manually added the steps to actually open the second Page Setup dialog box in the beginning of the shortcut (File, Page Setup..., Options...)

I also did end up using the AppleScript below as the last piece of the QuicKeys shortcut (you can embed AppleScript in your QuicKeys shortcuts... pretty cool).

tell application "Microsoft Excel"
        tell page setup object of active sheet
                set page orientation to landscape
                set zoom to false
                set fit to pages wide to 1
                set fit to pages tall to 9999
        end tell
end tell

works great... enjoy
 

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