?
Solved

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

Posted on 2014-12-15
3
Medium Priority
?
184 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:Michael Wolfstone
[X]
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
3 Comments
 
LVL 18

Accepted Solution

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

Assisted Solution

by:Nick67
Nick67 earned 1200 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:Michael Wolfstone
ID: 40503377
I tried both; together they worked.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

752 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