Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Page Setup Not Fitting To One Page Wide

I've written some code that allows users to change the print area on a
worksheet without ever having to actually play with the page setup options.
The actual setting of the print area works fine; however, we always always
want it to fit to one page wide, taking up the maximum width, and having the
number of pages tall vary depending on need.

What seems to happen is that sometimes, even though I believe I'm setting
everything properly, there's still a very generous amount of horizontal space
not being used. The margins are a constant .25". If I fiddle around with the
% zoom, I can get it to take up the entire width like I want. Any ideas what
could be going on?

The code is below:

With shtMain.PageSetup

.Zoom = False
.PaperSize = xlPaperLegal
.Orientation = xlLandscape

.FitToPagesTall = 300 ' Arbitrarily large number to ensure we have
enough pages tall - usually the number of pages neeed is betweem 2 and 7
.FitToPagesWide = 1 ' ALWAYS want 1 page wide

.PrintArea = objView.Address ' This works fine

.CenterHeader = "&""Times New Roman""&09&B" & strHeader

End With
--
Hmm...they have the Internet on COMPUTERS now!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Page Setup Not Fitting To One Page Wide

This code should accomplish what you are looking for. It will set the print
to optimum lenght based on 1 page wide.

ws.PageSetup.Zoom = False
ws.PageSetup.FitToPagesTall = False
ws.PageSetup.FitToPagesWide = 1

HTH
Cal

"MDW" wrote:

I've written some code that allows users to change the print area on a
worksheet without ever having to actually play with the page setup options.
The actual setting of the print area works fine; however, we always always
want it to fit to one page wide, taking up the maximum width, and having the
number of pages tall vary depending on need.

What seems to happen is that sometimes, even though I believe I'm setting
everything properly, there's still a very generous amount of horizontal space
not being used. The margins are a constant .25". If I fiddle around with the
% zoom, I can get it to take up the entire width like I want. Any ideas what
could be going on?

The code is below:

With shtMain.PageSetup

.Zoom = False
.PaperSize = xlPaperLegal
.Orientation = xlLandscape

.FitToPagesTall = 300 ' Arbitrarily large number to ensure we have
enough pages tall - usually the number of pages neeed is betweem 2 and 7
.FitToPagesWide = 1 ' ALWAYS want 1 page wide

.PrintArea = objView.Address ' This works fine

.CenterHeader = "&""Times New Roman""&09&B" & strHeader

End With
--
Hmm...they have the Internet on COMPUTERS now!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Page Setup Not Fitting To One Page Wide

WS. is a reference to a worksheet object

dim ws as worksheet
set ws = activesheet
ws.PageSetup.Zoom = False
ws.PageSetup.FitToPagesTall = False
ws.PageSetup.FitToPagesWide = 1

"CBrine" wrote:

This code should accomplish what you are looking for. It will set the print
to optimum lenght based on 1 page wide.

ws.PageSetup.Zoom = False
ws.PageSetup.FitToPagesTall = False
ws.PageSetup.FitToPagesWide = 1

HTH
Cal

"MDW" wrote:

I've written some code that allows users to change the print area on a
worksheet without ever having to actually play with the page setup options.
The actual setting of the print area works fine; however, we always always
want it to fit to one page wide, taking up the maximum width, and having the
number of pages tall vary depending on need.

What seems to happen is that sometimes, even though I believe I'm setting
everything properly, there's still a very generous amount of horizontal space
not being used. The margins are a constant .25". If I fiddle around with the
% zoom, I can get it to take up the entire width like I want. Any ideas what
could be going on?

The code is below:

With shtMain.PageSetup

.Zoom = False
.PaperSize = xlPaperLegal
.Orientation = xlLandscape

.FitToPagesTall = 300 ' Arbitrarily large number to ensure we have
enough pages tall - usually the number of pages neeed is betweem 2 and 7
.FitToPagesWide = 1 ' ALWAYS want 1 page wide

.PrintArea = objView.Address ' This works fine

.CenterHeader = "&""Times New Roman""&09&B" & strHeader

End With
--
Hmm...they have the Internet on COMPUTERS now!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Page Setup Not Fitting To One Page Wide

First, you should be able to just use
..fittopagestall = false
instead of fiddling with any number.

My second guess is that you may be printing empty columns. Maybe objview
includes columns that are empty???

MDW wrote:

I've written some code that allows users to change the print area on a
worksheet without ever having to actually play with the page setup options.
The actual setting of the print area works fine; however, we always always
want it to fit to one page wide, taking up the maximum width, and having the
number of pages tall vary depending on need.

What seems to happen is that sometimes, even though I believe I'm setting
everything properly, there's still a very generous amount of horizontal space
not being used. The margins are a constant .25". If I fiddle around with the
% zoom, I can get it to take up the entire width like I want. Any ideas what
could be going on?

The code is below:

With shtMain.PageSetup

.Zoom = False
.PaperSize = xlPaperLegal
.Orientation = xlLandscape

.FitToPagesTall = 300 ' Arbitrarily large number to ensure we have
enough pages tall - usually the number of pages neeed is betweem 2 and 7
.FitToPagesWide = 1 ' ALWAYS want 1 page wide

.PrintArea = objView.Address ' This works fine

.CenterHeader = "&""Times New Roman""&09&B" & strHeader

End With
--
Hmm...they have the Internet on COMPUTERS now!


--

Dave Peterson
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
Page layout - page setup - items disabled Bill D - Hubbard & Co Excel Discussion (Misc queries) 6 February 2nd 10 04:34 PM
FORMAT EXCEL WORKBOOK (PAGE SETUP) ALL AT ONCE INSTEAD OF BY PAGE fred Excel Discussion (Misc queries) 1 August 11th 08 04:54 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
Page Setup from VBA prints half wide Student Excel Programming 1 July 7th 06 08:39 PM
Page Header with Fit to 1 page wide Josh Smith[_2_] Excel Programming 0 July 15th 03 09:51 PM


All times are GMT +1. The time now is 11:43 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"