ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Before and After Print macro (https://www.excelbanter.com/excel-programming/292160-before-after-print-macro.html)

CLR

Before and After Print macro
 
Hi All...........

If you please.........is it possible to construct a macro that will fire
Macro "A" as a "Before-print" event and Macro "B" as an "After-print" event
for the same print event.

TIA
Vaya con Dios,
Chuck, CABGx3




Dave Peterson[_3_]

Before and After Print macro
 
There is a workbook_beforeprint that you can tie into.

But there is no workbook_afterprint event.

maybe you could work off a timer???

Behind the ThisWorkbook module:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

'your beforeprint code here

Application.OnTime Now + TimeSerial(0, 0, 10), "RunAfterPrint"

End Sub

Then in a general module:

Option Explicit
Sub runAfterPrint()
'your code here
End Sub

(I waited 10 seconds. Adjust as necessary.)

CLR wrote:

Hi All...........

If you please.........is it possible to construct a macro that will fire
Macro "A" as a "Before-print" event and Macro "B" as an "After-print" event
for the same print event.

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson


CLR

Before and After Print macro
 
Thanks Dave, for a very clever solution where no conventional one
exists...........

Vaya con Dios,
Chuck, CABGx3



"Dave Peterson" wrote in message
...
There is a workbook_beforeprint that you can tie into.

But there is no workbook_afterprint event.

maybe you could work off a timer???

Behind the ThisWorkbook module:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)

'your beforeprint code here

Application.OnTime Now + TimeSerial(0, 0, 10), "RunAfterPrint"

End Sub

Then in a general module:

Option Explicit
Sub runAfterPrint()
'your code here
End Sub

(I waited 10 seconds. Adjust as necessary.)

CLR wrote:

Hi All...........

If you please.........is it possible to construct a macro that will

fire
Macro "A" as a "Before-print" event and Macro "B" as an "After-print"

event
for the same print event.

TIA
Vaya con Dios,
Chuck, CABGx3


--

Dave Peterson





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

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