ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looking for a 'Close Print Preview' event (https://www.excelbanter.com/excel-programming/433527-looking-close-print-preview-event.html)

Michelle

Looking for a 'Close Print Preview' event
 
I want to alter a sheet when the user goes into print preview (no problem
with that - I use the BeforePrint event)

But I want to put it back to normal when the user closes print peview. Is
there an event I can use to put it back? - a sort of 'AfterPrintPreview'
event.

Thanks

M


Héctor Miguel

Looking for a 'Close Print Preview' event
 
hi, Michelle !

I want to alter a sheet when the user goes into print preview (no problem with that - I use the BeforePrint event)
But I want to put it back to normal when the user closes print peview.
Is there an event I can use to put it back? - a sort of 'AfterPrintPreview' event...


(AFAIK) *IF* the user goes first into a print preview, '_beforeprint' event could it be triggered twice
- one when print preview is choosen
- once more *IF* the user chooses *print* from there

also, the print preview (dialog) can be closed either by *cancel* or *print*, so...
- which one do you think should it be "controlled" ?

(FWIW) you can simulate an '_afterprint' event by using a normal procedure
- called by "OnTime" in '_beforeprint' event (i.e.)

== in ThisWorkbook code module ==
Private Sub Workbook_BeforePrint(Cancel As Boolean)
' do your stuff here, and...
' when the user releases the control (from the dialog) to the application... '
Application.OnTime Now, "afterprint_macro"
End Sub

== in a standard code module ==
Private Sub AfterPrint_Macro()
' here goes your afterPrint actions ... '
End Sub

hth,
hector.



Michelle

Looking for a 'Close Print Preview' event
 
Very good, thanks, the on-time solution works a treat.

M

"Héctor Miguel" wrote in message
...
hi, Michelle !

I want to alter a sheet when the user goes into print preview (no problem
with that - I use the BeforePrint event)
But I want to put it back to normal when the user closes print peview.
Is there an event I can use to put it back? - a sort of
'AfterPrintPreview' event...


(AFAIK) *IF* the user goes first into a print preview, '_beforeprint'
event could it be triggered twice
- one when print preview is choosen
- once more *IF* the user chooses *print* from there

also, the print preview (dialog) can be closed either by *cancel* or
*print*, so...
- which one do you think should it be "controlled" ?

(FWIW) you can simulate an '_afterprint' event by using a normal procedure
- called by "OnTime" in '_beforeprint' event (i.e.)

== in ThisWorkbook code module ==
Private Sub Workbook_BeforePrint(Cancel As Boolean)
' do your stuff here, and...
' when the user releases the control (from the dialog) to the
application... '
Application.OnTime Now, "afterprint_macro"
End Sub

== in a standard code module ==
Private Sub AfterPrint_Macro()
' here goes your afterPrint actions ... '
End Sub

hth,
hector.




All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com