PC Review


Reply
Thread Tools Rate Thread

BeforePrint & PrintPreview Hangs

 
 
Cassie
Guest
Posts: n/a
 
      9th Apr 2010
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 With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      9th Apr 2010
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" <(E-Mail Removed)> wrote in message
news:7FBC4AFC-F347-4F1C-985E-(E-Mail Removed)...
> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
BeforePrint robzrob Microsoft Excel Programming 0 14th Dec 2009 10:37 PM
BeforePrint =?Utf-8?B?Um9iaW4gQ2xheQ==?= Microsoft Excel Programming 6 13th Feb 2007 03:48 PM
BeforePrint help =?Utf-8?B?Um9va2llIDFzdCBjbGFzcw==?= Microsoft Excel Programming 4 19th Nov 2005 09:57 PM
ADO 2.7 & ADO 2.8 beforeprint =?Utf-8?B?SkNhbnlvbmVlcg==?= Microsoft Excel Programming 8 30th Mar 2005 04:05 PM
using beforeprint k483 Microsoft Excel Misc 1 15th Jul 2004 06:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 AM.