Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do I set printing options that work for Excel 2003 created in Access 2003 with VBA

Posted on 2014-12-15
3
149 Views
Last Modified: 2014-12-16
I am trying to code a spreadsheet from Access 2003 that will print in landscape on a 1-wide format.  I can get the landscape setting but the code for 1-wide is not working or holding in the saved spreadsheet.  I am trying with the following code:
    xlsSheet.pagesetup.Orientation = xllandscape
'    xlsSheet.pagesetup.printgridlines = True
    xlsSheet.pagesetup.printheadings = True
    xlsSheet.pagesetup.leftheader = "Weekly Handbag Report"
    xlsSheet.pagesetup.rightheader = "&D &T"
    xlsSheet.pagesetup.PrintArea = "A2:P" & LastLine
'    xlsSheet.pagesetup.FitToPagesTall = ""
    xlsSheet.pagesetup.fittopageswide = 1
    xlsSheet.Activate
    xlsSheet.pagesetup.printtitlerows = activesheet.rows(1).Address
0
Comment
Question by:BFOG
3 Comments
 
LVL 18

Accepted Solution

by:
Simon earned 200 total points
ID: 40501733
I think you need
        .FitToPagesWide = 1
        .FitToPagesTall = False
0
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 300 total points
ID: 40501734
You missed a small detail
xlsSheet.PageSetup.Zoom = False
The default must be true.  Set it, and your code works

From the O2003 help
FitToPagesWide Property
Returns or sets the number of pages wide the worksheet will be scaled to when it's printed. Applies only to worksheets. Read/write Variant.
Remarks
If this property is False, Microsoft Excel scales the worksheet according to the FitToPagesTall property.
If the Zoom property is True, the FitToPagesWide property is ignored.
Example
This example causes Microsoft Excel to print Sheet1 exactly one page wide and tall.
With Worksheets("Sheet1").PageSetup
    .Zoom = False
    .FitToPagesTall = 1
    .FitToPagesWide = 1
End With

0
 

Author Comment

by:BFOG
ID: 40503377
I tried both; together they worked.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Viewers will learn how the fundamental information of how to create a table.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question