Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default BeforePrint & PrintPreview Hangs

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
BeforePrint joeeng Excel Programming 1 November 7th 08 11:17 AM
BeforePrint help Rookie 1st class Excel Programming 4 November 19th 05 09:57 PM
BeforePrint Add In Daniel McCollick[_2_] Excel Programming 10 June 10th 05 08:07 PM
ADO 2.7 & ADO 2.8 beforeprint JCanyoneer Excel Programming 7 March 30th 05 04:05 PM
Help with BeforePrint Eric[_7_] Excel Programming 2 October 9th 03 07:44 PM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"