• Page Setup in VBA (1 Page) (Excel 97)

    Author
    Topic
    #378647

    Hi There,

    To automate some formatting I have to do to ALOT of worksheets I have the following code:

    Cells.Select
    With Selection
    .WrapText = False
    .MergeCells = False
    End With
    With ActiveSheet.PageSetup
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    End With

    This code is attached to a button on the toolbar. It should unwrap & unmerge all fields and set the page setup to 1 page.

    It does the unwrap & unmerge just fine, but the page setup part isn’t working.

    What I noticed is that unless the radio button for ‘Fit to” is already selected this will not do anything.

    What I guess I really need to do is select the option for 1 page by 1 page.

    How do I do this?

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #627403

      OK, I think I just solved my own problem.

      I took a look at the original code (down through recording a macro) and started commenting out lines one-by-one. It continued to work until I commented out

      .zoom=false

      So by keeping in the .zoom = false my code works to set my page to print the way I want it..

      Thanks!

    Viewing 0 reply threads
    Reply To: Page Setup in VBA (1 Page) (Excel 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: