View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default BeforePrint & PrintPreview Hangs

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).

--
Rick (MVP - Excel)



"Cassie" wrote in message
...
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?

--
Regards, Cassie