Is it possible to display a MsgBox for 5 seconds and then make it disappear
without clicking the OK button? I looked at help under MsgBox but did not
see such an option. Is there some other way to achieve the same result?
--Carlos
Is it possible to display a MsgBox for 5 seconds and then make it disappear
without clicking the OK button? I looked at help under MsgBox but did not
see such an option. Is there some other way to achieve the same result?
--Carlos
Carlos,
In VBA, go to the Tools menu, choose References, and scroll down
to "Windows Script Host Object Model". Check this item in the
list. Then, use code like
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long
Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"CarlosAntenna" <[email protected]> wrote in message
news:[email protected]...
> Is it possible to display a MsgBox for 5 seconds and then make
> it disappear
> without clicking the OK button? I looked at help under MsgBox
> but did not
> see such an option. Is there some other way to achieve the
> same result?
>
> --Carlos
>
>
You could make your msgbox with a user form and have the form run the
following when it activates
Private Sub UserForm_Activate()
Application.OnTime Now + TimeValue("00:00:10"), "CloseForm"
End Sub
The "CloseForm" is a macro which closes the user form :-
Public Sub CloseForm()
Unload userform1
End Sub
"CarlosAntenna" wrote:
> Is it possible to display a MsgBox for 5 seconds and then make it disappear
> without clicking the OK button? I looked at help under MsgBox but did not
> see such an option. Is there some other way to achieve the same result?
>
> --Carlos
>
>
>
Chip, You're a genius.
It works like a charm. You even included the OK button for users who are
too impatient to wait 5 seconds.
Thanks for the rapid response.
-- Carlos
"Chip Pearson" <[email protected]> wrote in message
news:[email protected]...
> Carlos,
>
> In VBA, go to the Tools menu, choose References, and scroll down
> to "Windows Script Host Object Model". Check this item in the
> list. Then, use code like
>
> Dim SH As IWshRuntimeLibrary.WshShell
> Dim Res As Long
> Set SH = New IWshRuntimeLibrary.WshShell
> Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
> Title:="Hello, World", Type:=vbOKOnly)
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
>
> "CarlosAntenna" <[email protected]> wrote in message
> news:[email protected]...
> > Is it possible to display a MsgBox for 5 seconds and then make
> > it disappear
> > without clicking the OK button? I looked at help under MsgBox
> > but did not
> > see such an option. Is there some other way to achieve the
> > same result?
> >
> > --Carlos
> >
> >
>
>
Thanks Big. I have not tried your solution because I already got it working
with Chip's method. Yours looks like exactly the kind of work-around I was
looking for.
Thanks,
--Carlos
"bigwheel" <[email protected]> wrote in message
news:[email protected]...
> You could make your msgbox with a user form and have the form run the
> following when it activates
>
> Private Sub UserForm_Activate()
>
> Application.OnTime Now + TimeValue("00:00:10"), "CloseForm"
>
> End Sub
>
> The "CloseForm" is a macro which closes the user form :-
>
> Public Sub CloseForm()
> Unload userform1
> End Sub
>
>
> "CarlosAntenna" wrote:
>
> > Is it possible to display a MsgBox for 5 seconds and then make it
disappear
> > without clicking the OK button? I looked at help under MsgBox but did
not
> > see such an option. Is there some other way to achieve the same result?
> >
> > --Carlos
> >
> >
> >
How can I set it to less than 1 second?
Administrative Note:
Welcome to the forum.
We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.
Please see Forum Rule #4 about hijacking and start a new thread for your query.
If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks