Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer in VBA peyman Excel Discussion (Misc queries) 2 October 5th 07 06:53 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
timer nyn04[_6_] Excel Programming 1 September 22nd 04 04:47 PM
Timer Don Lloyd Excel Programming 0 October 18th 03 03:40 AM
Put a timer on a MsgBox? Joe 90 Excel Programming 6 July 12th 03 05:31 PM


All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"