![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Houston TX
Posts: 549
|
Would like to capture a AFTERPRINT event in EXCEL 97.
Thank you. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Denver, Colorado USA
Posts: 4,014
|
Hi Bill,
There is no AfterPrint event, but you can effectively create your own using the BeforePrint event as follows: Private Sub Workbook_BeforePrint(Cancel As Boolean) Static PrintRequest As Boolean If PrintRequest = True Then Exit Sub PrintRequest = True ActiveSheet.PrintOut 'PUT YOUR AfterPrint CODE HERE 'This code will execute AFTER the print is completed PrintRequest = False Cancel = True End Sub The way this works is simply to cancel the manually-requested print, and instead execute a print from VBA so that right after the print you can do whatever operation you want. Keep Excelling. Damon
__________________
Keep Excelling. Damon VBAexpert Excel Consulting (My other life: http://damonostrander.com ) |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Damon, what a great idea! I've encountered this before and never even thought of going that route.
Regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Damon
Good idea.....however it's the Printpreview that usually is the problem for Print event codes....ie. code will also run in Printpreview........I'm trying to work on code around this...so far I only have a hack cheers Ivan |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Houston TX
Posts: 549
|
Damon,
That was an excellent Idea. Not too sure about IVAN and the problem he faces using PRINT PREVIEW... 4 now though, the solution is what the doctor ordered! Bill |
|
|
|
|
|
#6 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
still run...try it and see.... This is what I'm trying to work over... at the moment I just have a Hack fix... Ivan |
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Houston TX
Posts: 549
|
Thanks Ivan,
I actually noticed the flaw when an associate dropped a stack of printouts on my desk due to print preview No fix yet I presume? |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|