Results 1 to 7 of 7
  1. #1
    Tuc
    Guest

    PrintPreview vs. PrintOut

    How would I determine if the user chose print preview or is just printing the document?
    I am using Excel 97 (SR2 - h).

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrintPreview vs. PrintOut

    I assume that you mean in the BeforePrint event procedure. I actually don't see any way to tell. Can you tell us what you are trying to accomplish, and maybe we can come up with some other way to do it.
    Legare Coleman

  3. #3
    Tuc
    Guest

    Re: PrintPreview vs. PrintOut

    Okay. I had hoped to spare you the gory details, but here goes...
    I have a worksheet that is works out to be approximately 3 pages. It starts out to be 10 columns wide, but when I print the sheet, I do not want to print everything so I copy the content to another portion of the worksheet, delete the appropriate ranges, then reset the print area to be this new area.
    Now for illustration purposes let's say that Page 1 is 10 columns wide, Page 2 is 5 columns wide, and Page 3 is 7 columns wide. If I set the PageSetup property FitToPagesWide = 1 then the entire print area is adjusted to a zoom factor of say 68%. Page 1 prints perfectly, but Page 2 looks funny because it's not utilizing the entire page area, and Page 3 may or may not be affected.
    I am figuring the the only way to work around this is to send a series of print jobs, essentially each page would be it's own job, and I'd manipulate the desire print area for each page in terms of sizing and controlling just how the output would be displayed.
    Now, if I did that, then I would only be able to show the first page via print preview, or I'd have select all three print sections into one print area in order to display a print preview. BTW I did try to set up a non-contiguous print area in the hopes that the print engine would treat each print area section differently, but it did not have any affect.
    Thanks for thinking about the issue.

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrintPreview vs. PrintOut

    My suggestion would be to put each page on a separate sheet. That way, you can control the print setup for each page separately.

    If you have to, you can use customized menues and tool bars that intercept the Print and Print Preview buttons into your own routines and do what you need to do there.
    Legare Coleman

  5. #5
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrintPreview vs. PrintOut

    This is maybe not the solution to your problem but it might point you to some possibilities:
    The macro below loops through all sheets, sets the printarea to Range("A1").Currentregion.Address. This assumes that the area that is printed has no empty rows or columns. Then it shrinks the printarea to fit in one page (if necessary) and prints the activesheet.

    Sub Macro1()
    Dim Sh As Worksheet
    Dim R As Range
    For Each Sh In Worksheets
    Sh.Select
    Set R = ActiveSheet.Range("A1").CurrentRegion
    ActiveSheet.PageSetup.PrintArea = R.Address
    With ActiveSheet.PageSetup
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    End With
    ActiveSheet.PrintOut Copies:=1, Collate:=True
    Next Sh
    End Sub

  6. #6
    Tuc
    Guest

    Re: PrintPreview vs. PrintOut

    That would be good if I was dealing with reasonable users...

    Unfortunately, I need to keep the three groupings together and separated only by pagebreaks. Although I suppose I could copy the relevent information to a separate worksheet and print THAT worksheet instead. Hmmmm. It's already a lot of manipulation that I suppose more wouldn't hurt (much).

  7. #7
    Tuc
    Guest

    Re: PrintPreview vs. PrintOut

    Thanks for thinking about it.

Posting Permissions

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