Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Msgbox freezing in beforeprint module

This has been driving me crazy!
I have msgbox code validating data in both my before_print and before_save
modules; the code is identical in both (except for some slight text changes
in the message boxes). When I save the document the message box pops up and
closes correctly; when I print/print preview the message box pops up, allows
you to click the "OK" button, but remains on the screen and doesn't allow you
to close it (either with the red x button or by clicking OK again). The only
way I've figured to get around it is to manually run another macro that plugs
in dummy data where I've had the code validate. Below is one of the msgbox
sections, as I said before both the before_save and before_print modules are
identical.
The idea is if a checkbox is selected (in this case, biotaarrowcheck1) then
data must be entered in at least one of the cells in the range (h37:n37). If
data is not entered, the message box pops up and cancels the save/print,
cancels the procedure, and goes away. It would be nice if it could select a
range at the end (.range("h37").select), but when I added that to the
procedure beforesave didn't work at all. Thank you for all your help, I've
been wrestling with this for a while.

With worksheets("human health csm")
'Tests Ingestion of Wild Foods row
If .BiotaArrowCheck1.value = True Then
If Application.CountA(.range("h37:n37")) < 1 Then
MsgBox ("Please enter the current and/or future receptors in the
Ingestion of Wild Foods row." & vbNewLine & "Your action has been cancelled.")
Cancel = True
End
End If
End If
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Msgbox freezing in beforeprint module

I couldn't duplicate this behaviour (in Excel XP), so I can't be sure
what is going on. However, it sounds like it MIGHT be a problem with
screenupdating being turned off by some other event procedure - that
"End" statement might prevent screenupdating being turned on again.
A couple of things to try:

1. replace END with EXIT SUB
2. if that doesn't do it, just before the exit sub put in msgbox
application.screenupdating just to see if the screenupdating is off
or not
3. add a break point and then step through this procedure to see if
any other code is being invoked (e.g. by some other application event)

David Sauder
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Msgbox freezing in beforeprint module

David,
Thank you so much for your reply! I didn't even think about the
application.screenupdating part, I did indeed have it set to false at the
beginning of the procedure, and the END statement wasn't resetting it to
true. I added application.screeupdating = true just before the END statement
and it did the trick. Again, thank you!
-Hannah

"David Sauder" wrote:

I couldn't duplicate this behaviour (in Excel XP), so I can't be sure
what is going on. However, it sounds like it MIGHT be a problem with
screenupdating being turned off by some other event procedure - that
"End" statement might prevent screenupdating being turned on again.
A couple of things to try:

1. replace END with EXIT SUB
2. if that doesn't do it, just before the exit sub put in msgbox
application.screenupdating just to see if the screenupdating is off
or not
3. add a break point and then step through this procedure to see if
any other code is being invoked (e.g. by some other application event)

David Sauder

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 Robin Clay Excel Programming 4 February 13th 07 03:48 PM
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 10:58 AM.

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

About Us

"It's about Microsoft Excel"