Message Box Duration

T

TONYC

When a macro is run and a message box appears (using the 'MsgBox'
command) in visual basic, is there any way to have the message box
appear for say 5 seconds and then disspear from the screen, without the
user having to click OK.

Tony
 
R

Robin Clay

-----Original Message-----
When a macro is run and a message box appears
(using the 'MsgBox' command) in visual basic,
is there any way to have the message box
appear for say 5 seconds and then disspear
from the screen, without the
user having to click OK.

That would require suspension of activity.

What you could do instead is to
create a new empty sheet
and write a message into a Cell.

Then either Wait, or continue processing.
Then, after the Wait time, or after the
processing is complete, delete that worksheet.



RClay AT haswell DOT com
 
S

Soo Cheon Jheong

Hi,

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Sub TEST()

With CreateObject("WScript.Shell")
' Message ,Time, Title ,Type
.Popup "Welcome...", 5, "Excel User Group Korea", 0
End With

End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


--
Regards,
Soo Cheon Jheong
_ _
^¢¯^
--
 
C

Chip Pearson

OnTime will not work, because the event won't fire until the
message box is dismissed. Instead, set a reference to the Windows
Script Host Object Library (VBA Tools menu, References), and use
code like the following:

Dim WSH As IWshRuntimeLibrary.WshShell
Dim Res As Long
Set WSH = New IWshRuntimeLibrary.WshShell
Res = WSH.Popup(Text:="Click Yes Or No", _
secondstowait:=5, Type:=vbYesNo)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
S

ste mac

Hi,
This code should do what you need, l did not write it, and cannot
remember where l got it, apologies to author:

Sub msgboxfor5secs()
With CreateObject("Wscript.Shell")
.Popup "This message will be displayed for 5 seconds" _
, 3, "Self Closing MsgBox", 64
End With
End Sub

seeya ste
 
T

TONYC

Thank you - this works fine. I was also wondering if the message box ca
just show text, without the 'ok' button

TON
 
Top