Reputation: 1350
Seems simple and probably a case of "It's monday" but I can't find the answer to this.. without having to record all the pagesetup variables in strings beforehand, is there a way to copy a worksheets .pageSetup property?
in a macro im running, I create a new page, paste some data, change a bunch of pagesetup settings, then print. I was hoping there was a way i could save the page setup before hand, and apply it again afterwards so my users don't have to worry about fixing settings ever.
I tried:
dim ws as worksheet
set ws = ActiveSheet.pageSetup
'settings change / print
ActiveSheet.pagesetup = ws.pagesetup
that doesnt work because ws.pagesetup is now linked to activesheet.pagesetup, so as soon as i change the active sheets settings, ws's settings get changed too.
I also tried set ws = sheets(1)
because the new page is never the first page, but then with that one ActiveSheet.pagesetup = ws.pagesetup
doesnt work either, it says object doesn't support this property or method
Is there a simple way? must I have 20 different string variables to hold all the current pagesetup variables?
Thanks
Upvotes: 0
Views: 467
Reputation: 96753
Rather than coping page setting from a master sheet to other sheets:
In other words, anticipate your needs and setup the sheets in advance.
Upvotes: 1
Reputation: 199
When I want to accomplish something like this I'll save all my formatting and pagesetup stuff to a hidden sheet. At the right time I'll have my code copy and paste everything where I need it. In this case it would probably be easiest to start by making a copy of the hidden sheet. Then dump in your data and work from there.
Upvotes: 1