Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MsgBox with Timer
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MsgBox with Timer
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" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MsgBox with Timer
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
MsgBox with Timer
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" wrote in message ... 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" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
MsgBox with Timer
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" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Timer in VBA | Excel Discussion (Misc queries) | |||
Stopping a Timer / Running a timer simultaneously on Excel | Excel Discussion (Misc queries) | |||
timer | Excel Programming | |||
Timer | Excel Programming | |||
Put a timer on a MsgBox? | Excel Programming |