Not a problem to print report on two or more pages but what I would like to do is print on both sides of a page and for that I need to insert a page break. Neither of these I found in “Excel 2004 ApplescriptReference” work. Any suggestions appreciated.
tell application "Microsoft Excel"
make new horizontal page break at active sheet with properties {location:range ("A32")}
end tell
tell application "Microsoft Excel"
make new horizontal page break at active sheet with properties {location:range ("A32"), extent:page break full, horizontal page break type:page break manual}
end tell
Doesn’t work for me either in Excel 2011. I noticed a snippet in a mactech article that suggested including ‘at end’ as part of the ‘active sheet’ reference but that changed nothing.
And actually, I couldn’t get any real —i.e. non-error— response when I just tried to ‘get’ the page breaks… forget about making a new one. I can’t help but think that this functionality doesn’t exist (anymore).
Thanks for getting back to me, I guess I will just have to print on separate pages. I’m running Excelt through a 365 subscription and I thought that may have been the problem given you are on 11 that no seems unlikely
If your task is large and repetitive, then you could still try a couple of things… Have your script move to the target cell/range and then use UI scripting to insert the page break. Or get your script to run some VBA code that inserts the break.
Have you considered simply in Excel setting the cursor in the cell where you want to page break before and then going under the “Insert” menu and selecting “Page Break”?