Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing PageSetup Across All Worksheets
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 - - |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing PageSetup Across All Worksheets
Try changing
With ActiveSheet.PageSetup to With sh.PageSetup Don Guillett SalesAid Software "TOMB" wrote in message ... 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 - - |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing PageSetup Across All Worksheets
glad to help
-- Don Guillett SalesAid Software "TOMB" wrote in message ... Thanks. That did it. "Don Guillett" wrote: Try changing With ActiveSheet.PageSetup to With sh.PageSetup Don Guillett SalesAid Software "TOMB" wrote in message ... 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 - - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing footers on all worksheets without changing print set up | Excel Discussion (Misc queries) | |||
PageSetup | Excel Discussion (Misc queries) | |||
PageSetup | Excel Programming | |||
Changing page orientation with pagesetup | Excel Programming | |||
VBA 'PageSetup' performance | Excel Programming |