ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   after print (https://www.excelbanter.com/excel-programming/433418-after-print.html)

inungh

after print
 
I need set some controls invisible before print which works.

I need set them back visible after print, but after print event does
not exist.
I tried to put in the on activate and on change.

It seems on change event triggle too many times and on activate does
not triggle the codes when print finish.

Are there any workaround to have some code after print?

Your help is great appreciated,

Dave Peterson

after print
 
Do you hide the controls in the workbook_beforeprint event or do you have a
dedicated macro for printing?

I like the idea of the dedicated macro, then I can control everything I want.

I'd turn off printing in the workbook_beforeprint event:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
msgbox "Print via the dedicated macro"
cancel = true
End Sub

And in my dedicated macro, I'd...

hide the stuff
application.enableevents = false 'so that the before_print event doesn't run
print the other stuff
application.enableevents = true
unhide the stuff

=======
If you don't like that, you could use this technique:


You can use application.ontime to call another routine after a little bit.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
'your routine
'to hide the controls
Application.OnTime Now + TimeSerial(0, 0, 3), "AfterPrint"
End Sub

And in a general module:
Option Explicit
Sub AfterPrint()
'your routine to show the controls
End Sub

Chip Pearson explains application.ontime at:
http://www.cpearson.com/excel/OnTime.aspx

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)


inungh wrote:

I need set some controls invisible before print which works.

I need set them back visible after print, but after print event does
not exist.
I tried to put in the on activate and on change.

It seems on change event triggle too many times and on activate does
not triggle the codes when print finish.

Are there any workaround to have some code after print?

Your help is great appreciated,


--

Dave Peterson

inungh

after print
 
On Sep 10, 4:16*pm, Dave Peterson wrote:
Do you hide the controls in the workbook_beforeprint event or do you have a
dedicated macro for printing?

I like the idea of the dedicated macro, then I can control everything I want. *

I'd turn off printing in the workbook_beforeprint event:

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
* * msgbox "Print via the dedicated macro"
* * cancel = true
End Sub

And in my dedicated macro, I'd...

hide the stuff
application.enableevents = false 'so that the before_print event doesn't run
print the other stuff
application.enableevents = true
unhide the stuff

=======
If you don't like that, you could use this technique:

You can use application.ontime to call another routine after a little bit..

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
* * 'your routine
* * 'to hide the controls * *
* * Application.OnTime Now + TimeSerial(0, 0, 3), "AfterPrint"
End Sub

And in a general module:
Option Explicit
Sub AfterPrint()
* * 'your routine to show the controls
End Sub

Chip Pearson explains application.ontime at:http://www.cpearson.com/excel/OnTime.aspx

If you're new to macros:

Debra Dalgleish has some notes how to implement macros hehttp://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

inungh wrote:

I need set some controls invisible before print which works.


I need set them back visible after print, but after print event does
not exist.
I tried to put in the on activate and on change.


It seems on change event triggle too many times and on activate does
not triggle the codes when print finish.


Are there any workaround to have some code after print?


Your help is great appreciated,


--

Dave Peterson


Thanks millions for helping


All times are GMT +1. The time now is 03:38 AM.

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