Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Setting the print area in page set up to print 1 page wide by 2 pages tall EA[_2_] Excel Discussion (Misc queries) 2 July 12th 07 08:39 PM
How do I print a page with a horizontal layout? Bev Excel Discussion (Misc queries) 2 July 27th 06 02:59 PM
Can't change page layout to print one sided for the wholeworkbook David Excel Discussion (Misc queries) 0 July 5th 06 02:22 AM
Code for Print Layout Phil Osman Excel Discussion (Misc queries) 1 March 31st 05 06:18 AM


All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"