BeforePrint & PrintPreview Hangs

C

Cassie

Hi,

I am using Excel 2003 SP3 and have a BeforePrint macro that is causing

If I click on the Print Preview icon then while in "Print Preview",click the
"Print" button, the Print dialog box appears. If I click the "Cancel" button
at this point, excel exits the "Print Preview" and returns to my spreadsheet
but the "Print Preview button" stays depressed, the icon is an hourglass and
Excel gives a message that it needs to close down.

Private Sub Workbook_BeforePrint(Cancel As Boolean)

Cancel = True 'stop print

'Code here to change cell font to white

With ActiveSheet
Application.EnableEvents = False
.PrintOut 'print activesheet
Application.EnableEvents = True
End With

'Code here to change cell font to black

End Sub


My BeforePrint macro works fine in all other cases, is there any way to
prevent this happening?
 
R

Rick Rothstein

This is just a guess... remove the two Application.EnableEvents statements
and try it again (I can think of no reason to disable events for the
PrintOut statement and doing so may be affecting the code in it).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top