ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cancel Print (https://www.excelbanter.com/excel-programming/395100-cancel-print.html)

dg

Cancel Print
 
Excel 2003 - this code will still show the print dialog box. Is there anyway
to avoid it?

Public Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "No printing for you!"
Cancel = True
End Sub


Jim Cone

Cancel Print
 

On Windows XP with Excel 2002 or Excel 2003 running...
all I see is the message box, the print dialog box is not shown.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"DG"
wrote in message
Excel 2003 - this code will still show the print dialog box. Is there anyway
to avoid it?

Public Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "No printing for you!"
Cancel = True
End Sub


JE McGimpsey

Cancel Print
 
I don't see it in XL04 or XL03...

Do you have events enabled?

In article ,
DG wrote:

Excel 2003 - this code will still show the print dialog box. Is there anyway
to avoid it?

Public Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "No printing for you!"
Cancel = True
End Sub


dg

Cancel Print
 
Yes, but if I disable events then I will never see another prompt. So at what
point do I re-enable the events?

"JE McGimpsey" wrote:

I don't see it in XL04 or XL03...

Do you have events enabled?

In article ,
DG wrote:

Excel 2003 - this code will still show the print dialog box. Is there anyway
to avoid it?

Public Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "No printing for you!"
Cancel = True
End Sub



Dave Peterson

Cancel Print
 
Disable events for as short a period as you need.
Do what you need to do with the events disabled
Enable events



DG wrote:

Yes, but if I disable events then I will never see another prompt. So at what
point do I re-enable the events?

"JE McGimpsey" wrote:

I don't see it in XL04 or XL03...

Do you have events enabled?

In article ,
DG wrote:

Excel 2003 - this code will still show the print dialog box. Is there anyway
to avoid it?

Public Sub Workbook_BeforePrint(Cancel As Boolean)
MsgBox "No printing for you!"
Cancel = True
End Sub



--

Dave Peterson


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

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