View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default ThisWorkbook BeforePrint

Make sure that if you do this, you disable events prior to printing and
reenable them afterward, or you'll loop until you run out of stack
space. For instance:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
ActiveSheet.PrintOut
Application.EnableEvents = True
'Your code here
End Sub



In article ,
"Simon Shaw" <simonATsimonstoolsDOTcom wrote:

Hi,

I need to run code after a print job.
I am using
Private Sub Workbook_BeforePrint(Cancel As Boolean)
in ThisWorkbook to execute code prior to printing,
but then I want to run code after printing.

Thanks
Simon