Consulting

Results 1 to 5 of 5

Thread: After print event

  1. #1
    VBAX Regular
    Joined
    Feb 2013
    Posts
    41
    Location

    After print event

    Hello to all!

    It is any possibility to fins an "AfterPrint" event enabler.

    The problem is that I have an excel table with "Sheet1" where I insert some values, and on "Sheet2" an Pivot table. After printing the pivot table I need to save the eralier inserted dates in "Sheet3" to keep hisory of movements.

    The problem is that I have managed to select "Sheet1"/copy"Sheet1"/paste to "Sheet3" via an VBA liked to an Button.
    I need to do this via VBA code.

    Any ideea?
    Thank you in advance

  2. #2
    VBAX Regular
    Joined
    Jan 2013
    Posts
    84
    Location
    I haven't tested this, but this might be what you can use.

    Excel VBA does not have an after print event, but use this workaround to call a function after the print event.
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
        Application.OnTime Now, "AfterPrint"
    End Sub
    
    Private Sub AfterPrint()
    'code to run after the print event goes here
    End sub
    The afterprint function is called after the print event occurred. Make sure to add the AfterPrint() in a module
    Last edited by Aussiebear; 07-15-2022 at 06:09 PM. Reason: Changed code tags

  3. #3
    VBAX Regular
    Joined
    Feb 2013
    Posts
    41
    Location
    Tested, but seams to do not work...

  4. #4

    Red face

    Thanks man that works

  5. #5
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    Even after 9 years .......

Posting Permissions

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