ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message Box Duration (https://www.excelbanter.com/excel-programming/306619-message-box-duration.html)

TONYC[_8_]

Message Box Duration
 
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


---
Message posted from http://www.ExcelForum.com/


BrianB

Message Box Duration
 
I use a textbox for things like this. Put on scree, use Wait, the
remove

--
Message posted from http://www.ExcelForum.com


Robin Clay[_3_]

Message Box Duration
 

-----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

TONYC[_9_]

Message Box Duration
 
Newbie wrote:
*Have you tried the OnTime method?

"TONYC " wrote:

When a macro is run and a message box appears (using the 'MsgBox'
command) in visual basic, is there any way to have the messag

box
appear for say 5 seconds and then disspear from the screen, withou

the
user having to click OK.

Tony


---
Message posted from http://www.ExcelForum.com/

*

No I have not tried the OnTime method, can you please elaborate

Ton

--
Message posted from http://www.ExcelForum.com


Soo Cheon Jheong[_2_]

Message Box Duration
 
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
_ _
^вп^
--



Chip Pearson

Message Box Duration
 
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



"Newbie" wrote in message
...
Have you tried the OnTime method?

"TONYC " wrote:

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


---
Message posted from http://www.ExcelForum.com/





ste mac

Message Box Duration
 
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

TONYC[_13_]

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

TON

--
Message posted from http://www.ExcelForum.com


Timster[_3_]

Message Box Duration
 
Nope
http://msdn.microsoft.com/library/de...wsmthpopup.asp

But I suppose you could put the function within a loop and keep showin
the dialog until you get a return value of -1 :

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com