Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default PageSetup changes not working in VBA

I am trying to change the PageSetup using VBA, but it does not seem to
take the changes. I tried using both the XL4M method and the
standard .PageSetup. I seem to be able to set the print area, but not
the PaperSize or the Orientation. I have stepped through the code and
it does not error out, but the settings do not change in PageSetup
either. The worksheet is not protected.

Here are the two methods that I used (I put the code for PageSetupXL4M
into its own macro).

With Worksheets("Master Index").PageSetup
'With ActiveSheet.PageSetup
'.PrintHeadings = False
.Zoom = False
.Orientation = page_orientation
.CenterHorizontally = False
.CenterVertically = False
.PaperSize = page_size
.FitToPagesWide = 1
.PrintErrors = xlPrintErrorsDisplayed
End With

PageSetupXL4M PrintHeadings:=False, _
Zoom:=False, _
Orientation:=page_orientation, _
CenterHorizontally:=False, _
CenterVertically:=False, _
PaperSize:=page_size

I have tried setting page_orientation to both the string "xlPortrait"
and the number xlPortrait (1).


Thanks for your help,
David

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default PageSetup changes not working in VBA

for some reason xlPaper11x17 does not change my paper size but
xlPaperTabloid does. I tried putting in numerical values and noticed
that some of the numbers do not change the size. For example
xlPaper11x17 gives 17, but if I give the number 17 directly nothing
happens. 11x17 and Tabloid are both listed as options for my printer.

Is one of these options more likely to work then the other? Will one
work on one computer and if I send it to another will it not work
there? How to I ensure that the worksheet will behave the same across
different computers/printers?

Should I set the page size in VBA then check to see if it took (also
in vba) if it did not try the other?

Thanks,
David

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
PageSetup Macro Julian Glass Excel Worksheet Functions 1 March 29th 08 01:54 PM
PageSetup Stanley Excel Discussion (Misc queries) 1 December 14th 05 07:21 PM
PageSetup Simon Shaw Excel Programming 3 May 28th 05 01:28 PM
Working with headers in pagesetup OkieViking Excel Programming 2 April 16th 05 11:47 PM
PageSetup Simon Shaw[_4_] Excel Programming 1 May 28th 04 08:41 AM


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