+ Reply to Thread
Results 1 to 5 of 5

Another way to suppress print besides Cancel = True?

  1. #1
    Forum Contributor
    Join Date
    06-23-2005
    Posts
    253

    Another way to suppress print besides Cancel = True?

    I have the following code to execute BeforePrint event.

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If ActiveSheet.Name = "Print Envelopes" Then
    Application.OnTime Now + TimeValue("00:00:05"), ThisWorkbook.Name & "!PrintEnvelopes"
    Cancel = True
    End If
    End Sub

    The problem is that I have a print routine within the code to be executed 5 seconds after clicking & the Cancel = True prevents it.

    Is there another way to suppress printing without using Cancel = True in the BeforePrint event?

    I want to be able to print via clicking printer Icon or running the code.

    Thanks a million. mikeburg

  2. #2
    Tom Ogilvy
    Guest

    Re: Another way to suppress print besides Cancel = True?

    No, but you can suppress events

    Sub PrintEnvelopes()
    Application.EnableEvents = False
    Activesheet.Printout
    Application.EnableEvents = True
    End Sub


    this might help your recursive calls to ontime as well.
    --
    Regards,
    Tom Ogilvy


    "mikeburg" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have the following code to execute BeforePrint event.
    >
    > Private Sub Workbook_BeforePrint(Cancel As Boolean)
    > If ActiveSheet.Name = "Print Envelopes" Then
    > Application.OnTime Now + TimeValue("00:00:05"), ThisWorkbook.Name &
    > "!PrintEnvelopes"
    > Cancel = True
    > End If
    > End Sub
    >
    > The problem is that I have a print routine within the code to be
    > executed 5 seconds after clicking & the Cancel = True prevents it.
    >
    > Is there another way to suppress printing without using Cancel = True
    > in the BeforePrint event?
    >
    > I want to be able to print via clicking printer Icon or running the
    > code.
    >
    > Thanks a million. mikeburg
    >
    >
    > --
    > mikeburg
    > ------------------------------------------------------------------------
    > mikeburg's Profile:

    http://www.excelforum.com/member.php...o&userid=24581
    > View this thread: http://www.excelforum.com/showthread...hreadid=490604
    >




  3. #3
    Forum Contributor
    Join Date
    06-23-2005
    Posts
    253
    Thanks for the response. Can't seem to get it to work.

    Is there a way to set the output to a dummy printer where nothing prints?

    thanks a million.. mikeburg

  4. #4
    Tom Ogilvy
    Guest

    Re: Another way to suppress print besides Cancel = True?

    You can use

    Activesheet.PrintPreview

    --
    Regards,
    Tom Ogilvy


    "mikeburg" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Thanks for the response. Can't seem to get it to work.
    >
    > Is there a way to set the output to a dummy printer where nothing
    > prints?
    >
    > thanks a million.. mikeburg
    >
    >
    > --
    > mikeburg
    > ------------------------------------------------------------------------
    > mikeburg's Profile:

    http://www.excelforum.com/member.php...o&userid=24581
    > View this thread: http://www.excelforum.com/showthread...hreadid=490604
    >




  5. #5
    Forum Contributor
    Join Date
    06-23-2005
    Posts
    253
    Still prints to the printer once preview is closed.

    Any other ideas?

    Thank you so very much. mikeburg

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1