Close a msgbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to close a msgbox programmatically? After an event occures,
I would like to show a message for 2 or 3 seconds and then continue with the
event procedure.
 
Frank C said:
Is there any way to close a msgbox programmatically? After an event occures,
I would like to show a message for 2 or 3 seconds and then continue with the
event procedure.

Not with a MsgBox, no, but you can create a small form of your own to do it.
Use the new form's timer event to close it automatically.
 
Rick Brandt said:
Not with a MsgBox, no, but you can create a small form of your own to do
it. Use the new form's timer event to close it automatically.

Actually, it can be done using the FindWindow and SendMessage APIs.

Karl E. Peterson has an example at
http://vb.mvps.org/samples/project.asp?id=TimedMsg that works fine in
Access.

One caveat, though: the message box MUST have a Cancel button on it for this
to work. If you've only got Yes and No buttons, for instance, it will not
work.
 
Douglas J. Steele said:
Actually, it can be done using the FindWindow and SendMessage APIs.

Karl E. Peterson has an example at
http://vb.mvps.org/samples/project.asp?id=TimedMsg that works fine in
Access.

One caveat, though: the message box MUST have a Cancel button on it
for this to work. If you've only got Yes and No buttons, for
instance, it will not work.

Cool! Without testing it, I can see how that would work, because I see
that a form's Timer event still fires even when code in some other event
is waiting for a response to a MsgBox. Whaddayaknow!
 
I tried to post this the other day but must have messed up.

Thasnk you all for you input. I ran Karl's demo and it is what I am looking
for.
One more problem that maybe you can help me with. I'm not sure what I
should put out of the 2 code documents and insert into an event procedure.
Also where would it go in the procedure in relationship to the mesbox
statement?
 
Back
Top