Excel VBA PageSetup Questions

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi,

I want to specify that my xlSheet objects page setup so that fit page is
enabled and put Page X of Y in the footer. I have so far:

With xlSheetNew.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = 1000
.LeftFooter = "Engman-Taylor Co."
.CenterFooter = "Page "
End With

My two problems are fittopage is not activated and I don't know how to
reference page and pages in the footer. Can anyone help me?

TIA,
Dan
 
Dan

Simply setting the properties enables fit to page and to set page x of total
pages you need

..LeftFooter = "&P of &N"

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Thanks for the pages info. Regarding the FitToPage, when I check the
page setup from Excel's File -> Page Setup menu the 1 x 1000 is there
but scaling is still set to adjust 100%. How can I get it so Scaling is
set to Fit To?

Dan
 
When I want to make my printed copy only one page wide, I empty out the pages
tall. I just let xl figure it out. (I'm guessing that that's what 1000 did for
you.)

I get this in my recored macro:

.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False


That ".zoom = False" may fix your problem--it's important.
 
That did it!

Thx, Dan

When I want to make my printed copy only one page wide, I empty out the pages
tall. I just let xl figure it out. (I'm guessing that that's what 1000 did for
you.)

I get this in my recored macro:

.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False


That ".zoom = False" may fix your problem--it's important.
 
Back
Top