![]() |
Setting page layout and print set up in code for a new worksheet
I have just created a new worksheet with the data the way I want it. Now I
would like to set the page layout for printing to landscape and set it so it scales to print 1 page wide by 10 pages long. Can this be done in code. In my code the sheet is called wbNew.Sheets("results") Thanks |
Setting page layout and print set up in code for a new worksheet
Try below. The best way would be to record a macro and review the code which
is generated....Then edit to suit your requirements... With wbNew.Sheets("results").PageSetup .Orientation = xlLandscape .PaperSize = xlPaperA4 .Order = xlDownThenOver .FitToPagesWide = 1 .FitToPagesTall = 10 End With -- If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I have just created a new worksheet with the data the way I want it. Now I would like to set the page layout for printing to landscape and set it so it scales to print 1 page wide by 10 pages long. Can this be done in code. In my code the sheet is called wbNew.Sheets("results") Thanks |
Setting page layout and print set up in code for a new workshe
Thanks again. It didn't work properly so I did what you said and found i
needed this. With wbNew.Sheets("results").PageSetup .Orientation = xlLandscape .PaperSize = xlPaperA4 .Order = xlDownThenOver .Zoom= False .FitToPagesWide = 1 .FitToPagesTall = 10 End With I have tried using record macro before but sometimes it seems to record stuff that needs to be changed to make vb code work in programs (eg applications). "Jacob Skaria" wrote: Try below. The best way would be to record a macro and review the code which is generated....Then edit to suit your requirements... With wbNew.Sheets("results").PageSetup .Orientation = xlLandscape .PaperSize = xlPaperA4 .Order = xlDownThenOver .FitToPagesWide = 1 .FitToPagesTall = 10 End With -- If this post helps click Yes --------------- Jacob Skaria "NDBC" wrote: I have just created a new worksheet with the data the way I want it. Now I would like to set the page layout for printing to landscape and set it so it scales to print 1 page wide by 10 pages long. Can this be done in code. In my code the sheet is called wbNew.Sheets("results") Thanks |
All times are GMT +1. The time now is 01:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com