Hi
I am looking for a vba code to to close a message box after a few seconds. I can get it to work on one spreadsheet but not another. What would cause this?
Thanks
George
Hi
I am looking for a vba code to to close a message box after a few seconds. I can get it to work on one spreadsheet but not another. What would cause this?
Thanks
George
Hi,
the code for sure …
Hello
Something like this?
![]()
CreateObject("WScript.Shell").Popup "Place message here", 5, "Message Title"
Regards
Fotis.
-This is my Greek whisper to Europe.
--Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Advanced Excel Techniques: http://excelxor.com/
--KISS(Keep it simple Stupid)
--Bring them back.
---See about Acropolis of Athens.
--Visit Greece.
Hi, dode,
the code Fotis supplied is working fine for me (I used 3 seconds) - maybe consider to use a UserForm which could be released after the wanted time (timer would be started when UF is activated/initialized).
This is a more detailed sample of the code supplied:
Ciao,![]()
Sub Welcome() Dim WsShell Dim lngRet As Long Const clngSEC As Long = 3 Set WsShell = CreateObject("WScript.Shell") lngRet = WsShell.Popup("Welcome to my home!", clngSEC, "MessageBox will close after " & clngSEC & " seconds!") Set WsShell = Nothing End Sub
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
A small example of what i suggested..![]()
Would it make a difference running on xp?
No. ................
I eventually got it to work. I'm not entirely sure why it wasnt working on all workbooks but when I opened another workbook and went back to the first one, it worked.
Thanks for your help
George
The Popup method is not reliable in my experience so I'd be careful about relying on it. I'd always use a userform in preference, myself, as HaHoBe suggested.
Everyone who confuses correlation and causation ends up dead.
I think a small Userform is better as Hahobe and Rory already said.
something like that....
![]()
'somewhere where you want to see it UserForm1.show '
![]()
Private Sub UserForm_Initialize() Me.StartUpPosition = 0 Me.Top = 250 Me.Left = 400 Application.OnTime Now + TimeValue("00:00:02"), "closeUF1" End Sub
![]()
'in a new module Sub closeUF1() Unload UserForm1 End Sub
Last edited by john55; 04-07-2014 at 02:58 AM.
Regards, John55
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
...enjoy -funny parrots-
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks