Message Box Duration

  • Thread starter Thread starter TONYC
  • Start date Start date
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
 
I use a textbox for things like this. Put on scree, use Wait, the
remove
 
-----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
 
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
_ _
^¢¯^
--
 
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
 
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
 
Thank you - this works fine. I was also wondering if the message box ca
just show text, without the 'ok' button

TON
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top