View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
A C A C is offline
external usenet poster
 
Posts: 8
Default copying PageSetup properties from one worksheet to another

Can you not copy the worksheet that has the page setup properties you want
to create and then clear the cells and any other irrelevant properties
within the copied sheet.


The short answer* is: No :) due to a whole lot of crummy details. I can
and do copy the new worksheet when making later worksheets, and that
inherits the PageSetup details so your suggestion is certainly a valid one.
Its just that for boring and long reasons I cannot do it for this first
one...

Thanks for the suggestion though
A

*Long answer for anyone who is interested.
The worksheet we are wanting to get the PageSetup info from is a "template"
style of worksheet. We have set up a full set of formulas and formatting
etc on this worksheet, but which formulas and formattings and rows/cols etc
we want is decided at execution time. So in other words during execution we
go to this "master template" sheet and based on certain parameters during
execution we pull various pieces of the master template out and apply them
to our worksheet, and leave the other pieces behind.
It works well, except for this pageSetup stuff which we *always* want. I am
unsure of the correct way to copy the pageSetup object properties from one
worksheet to another correctly.


--


XL2003
Regards

William



"A C" wrote in message
...
Hi

Can someone tell me how to correctly copy the PageSetup properties from

1
worksheet to another. I would like to copy every property over but dont
want to write code listing every single property, I would like to do it
"automatically" in the code.

For example, will the following work properly?

myNewWorksheet.PageSetup = myOldWorksheet.PageSetup


Or is there a way to loop over the pageSetup properties?
eg
for each ??? in PageSetup
myNewWorksheet.PageSetup.???? = myOldWorksheet.PageSetup.???
next ???


Thanks
A