Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Manipulating Excel, especially page format (2003)

    I use the following code to send data to excel and format it...
    <pre> Dim db As DAO.Database
    Set db = CurrentDb
    Dim rst As DAO.Recordset
    Dim wbkNew As Excel.Workbook, wksNew As Excel.Worksheet
    Dim appExcel As New Excel.Application
    Set wbkNew = appExcel.Workbooks.Add
    Set wksNew = wbkNew.Worksheets.Add
    appExcel.Visible = True

    With wksNew</pre>


    I can not, however, figure out how to manipulate the print settings...

    Any suggestions?
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Manipulating Excel, especially page format (2003)

    You could record a macro in Excel to see what code is generated, then copy the parts you need to Access, using wksNew as prefix. For example:
    <code>
    With wksNew.PageSetup
    .Orientation = xlLandscape
    .TopMargin = 72 ' points
    End With</code>

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Manipulating Excel, especially page format (20

    Ok, that worked, but this did not:
    <pre> .FitToPagesWide = 1
    .FitToPagesTall = 1</pre>

    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Manipulating Excel, especially page format (20

    Did you try to set

    .Zoom = False


    If it is set to true , it is ignored.
    Jerry

  5. #5
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Manipulating Excel, especially page format (20

    That fixed it!

    Thank you both very much!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •