From: John Keith on
I make use of a msgbox with Yes/No buttons fairly frequently, like:

answer = msgbox("Do you want to proceed?", vbyesno)

After clicking on the desired button the message box window remains
open. Is there a way to force closing this window as soon as the
variable is read?


John Keith
kd0gd(a)juno.com
From: JLGWhiz on
Is this a message box that was created with a UserForm? The standard
message box automatically closes when a button is clicked. If it is the
standard message box and is not closing, there could be a software problem
in your system. Is this in Excel, if so, what version.


"John Keith" <kd0gd(a)juno.com> wrote in message
news:mkd5r5dgd6mf3s53jh03jeg7dj7n28chpv(a)4ax.com...
>I make use of a msgbox with Yes/No buttons fairly frequently, like:
>
> answer = msgbox("Do you want to proceed?", vbyesno)
>
> After clicking on the desired button the message box window remains
> open. Is there a way to force closing this window as soon as the
> variable is read?
>
>
> John Keith
> kd0gd(a)juno.com


From: John Keith on
>Is this a message box that was created with a UserForm?

No

> The standard message box automatically closes when a button is clicked. If it is the
>standard message box and is not closing, there could be a software problem
>in your system. Is this in Excel, if so, what version.

Excel 2007/WinXP

The message box window stays open until the next msgbox command is
executed.

I also just tried the following

msgbox("Test")
for i =1 to 100000000
a=1
next i
msgbox("done")

The loop has not completed yet and the first message box is still
open.





John Keith
kd0gd(a)juno.com
From: Peter T on
What you describe cannot and occur. I very much doubt you actually tested
the code you posted as an example, at least not exactly as written and with
nothing else.

My guess is you are showing the msgbox with screenupdating disabled. The
msgbox will stay on the screen indefinitely until the screen is refreshed
(even DoEvents) or by re-enabling screenupdating.

Be sure to temporarily disable screenupdating if/as necessary when showing a
msgbox.

Regards,
Peter T

The only thing that
"John Keith" <kd0gd(a)juno.com> wrote in message
news:o3m5r5dpb4p28chv941hjmflecglohug0i(a)4ax.com...
> >Is this a message box that was created with a UserForm?
>
> No
>
>> The standard message box automatically closes when a button is clicked.
>> If it is the
>>standard message box and is not closing, there could be a software problem
>>in your system. Is this in Excel, if so, what version.
>
> Excel 2007/WinXP
>
> The message box window stays open until the next msgbox command is
> executed.
>
> I also just tried the following
>
> msgbox("Test")
> for i =1 to 100000000
> a=1
> next i
> msgbox("done")
>
> The loop has not completed yet and the first message box is still
> open.
>
>
>
>
>
> John Keith
> kd0gd(a)juno.com


From: JLGWhiz on
I can't duplicate the problem in xl2003, but it sounds like a software
glitch to me. The standard message box is designed to close immediately
upon execution of a button. Unless xl2007 has an option to open the message
box as modeless, I cannot offer any explanation for the behavior.




"John Keith" <kd0gd(a)juno.com> wrote in message
news:o3m5r5dpb4p28chv941hjmflecglohug0i(a)4ax.com...
> >Is this a message box that was created with a UserForm?
>
> No
>
>> The standard message box automatically closes when a button is clicked.
>> If it is the
>>standard message box and is not closing, there could be a software problem
>>in your system. Is this in Excel, if so, what version.
>
> Excel 2007/WinXP
>
> The message box window stays open until the next msgbox command is
> executed.
>
> I also just tried the following
>
> msgbox("Test")
> for i =1 to 100000000
> a=1
> next i
> msgbox("done")
>
> The loop has not completed yet and the first message box is still
> open.
>
>
>
>
>
> John Keith
> kd0gd(a)juno.com