![]() |
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 - - |
Changing PageSetup Across All Worksheets
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 - - |
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 - - |
All times are GMT +1. The time now is 05:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com