Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing format for an Excel spreadsheet

Status
Not open for further replies.

coswa

Technical User
Jun 16, 2008
7
US
I'm trying to clear up a minor nuisance I'm having. I have several macros, running from Attachmate, that output Excel spreadsheets that print out slightly too wide to fit on one page. Obviously, it's not hard to just change it myself after the macro's done, but I'd like to be able to be already setup to print to 1 page wide. The code I'm using to try to do this, which I copied and modified from a recorded Excel macro is:

Code:
with wb.worksheets("BatchListing").PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
        .PrintHeadings = False
        .PrintGridlines = False
        .CenterHorizontally = False
        .CenterVertically = False
        .BlackAndWhite = False
        .FitToPagesWide = 1
    End With

Any help would be appreciated
 




Code:
With Worksheets("BatchListing").PageSetup
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 999


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I just tried this, but I get an error message:

Micosoft Office Excel: Unable to set the Zoom Property of the PageSetup class

Taking it out results in nothing happening. Also, all the properties that include the letters "xl" that I got from recording/ pasting an excel macro result in unable to set property errors. I'm using Excel 2003 and myEXTRA! Enterprise 7.11, if that makes any diference.

Thanks,
Chris
 


1. be sure you nave an End With to match the With

2. try moving the Zoom statement after the FitTo statements.

It DOES work!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top