Solved

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

Posted on 2014-12-15
3
138 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now