Changing PageSetup Across All Worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to print several (30-40) workbooks which contain differently named
sheets and some do not have defined print properties. I have code that opens
any xls file in the designated folder, but I have not been able to set the
print properties for every sheet in each file as it opens.

I need to set the sheets to print landscape and fit to 1 page wide and 1
page tall.

I have started with the following code:

Dim sh As Worksheet

For Each sh In ActiveWorkbook.Sheets
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Next sh

End Sub

I have not been able to get the code to test correctly on a test file. Not
all settings seem to apply to all sheets.

Thanks for any help.

- - TB - -
 
Try changing
With ActiveSheet.PageSetup
to
With sh.PageSetup

Don Guillett
SalesAid Software
(e-mail address removed)
 
Thanks. That did it.

Don Guillett said:
Try changing
With ActiveSheet.PageSetup
to
With sh.PageSetup

Don Guillett
SalesAid Software
(e-mail address removed)
 

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

Back
Top