close msgbox with VBA code

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

Guest

I have an app that times out if inactive greater than 5 minutes.
Occasionally it is hung up by one of many messageboxes that does not close
when the app times out. I have found solutions for vbinformation or
vbcritical, however, what is the best way to code the messagebox to close
when it is a vbyes vbno or one with multiple choices?

Thanks
Jay
 
Depending on your exact situation, 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.
 
I am working through a test scenario where I have added the vbCance. So far
so good.

Thanks
Jay
 
Back
Top