Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, me again.., I'm trying to close a msgbox using application.ontime now
+ 5seg Thank you in advance -- Thank you... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
How about this which auto closes after 5 seconds or sooner if the user presses OK CreateObject("WScript.Shell").popup "Your Message", 5 Mike "EXCELMACROS" wrote: Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to close it in 5 seg, can't wait for the user to press "ok" what do
you think? -- Thank you... "Mike H" wrote: Hi, How about this which auto closes after 5 seconds or sooner if the user presses OK CreateObject("WScript.Shell").popup "Your Message", 5 Mike "EXCELMACROS" wrote: Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you need to go back and read my post again.
How about this which auto closes after 5 seconds or sooner if the user presses OK Mike "EXCELMACROS" wrote: I need to close it in 5 seg, can't wait for the user to press "ok" what do you think? -- Thank you... "Mike H" wrote: Hi, How about this which auto closes after 5 seconds or sooner if the user presses OK CreateObject("WScript.Shell").popup "Your Message", 5 Mike "EXCELMACROS" wrote: Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, I did copy paste exactly what you suggested and is not closing in 5
seg... -- Thank you... "Mike H" wrote: I think you need to go back and read my post again. How about this which auto closes after 5 seconds or sooner if the user presses OK Mike "EXCELMACROS" wrote: I need to close it in 5 seg, can't wait for the user to press "ok" what do you think? -- Thank you... "Mike H" wrote: Hi, How about this which auto closes after 5 seconds or sooner if the user presses OK CreateObject("WScript.Shell").popup "Your Message", 5 Mike "EXCELMACROS" wrote: Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Then I'm at a loss to understand why. I don't believe you need to set any references to make this work but perhaps someone else can enlighten us (me). Once again for me it displays for 5 seconds and then auto closes. I'll post it again in case tit became corrupted last time CreateObject("WScript.Shell").Popup "Your Message", 5, "User Message" Mike Mike "EXCELMACROS" wrote: Well, I did copy paste exactly what you suggested and is not closing in 5 seg... -- Thank you... "Mike H" wrote: I think you need to go back and read my post again. How about this which auto closes after 5 seconds or sooner if the user presses OK Mike "EXCELMACROS" wrote: I need to close it in 5 seg, can't wait for the user to press "ok" what do you think? -- Thank you... "Mike H" wrote: Hi, How about this which auto closes after 5 seconds or sooner if the user presses OK CreateObject("WScript.Shell").popup "Your Message", 5 Mike "EXCELMACROS" wrote: Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello EXCELMACROS, Here is macro to close the dialog after 5 seconds. You can change this to suite your needs. Code: -------------------- Sub TimedMsgBox() Dim Msg As String Dim Secs As Long Dim Wsh As Object Title = "Test" Msg = "This will close in 5 seconds." Secs = 5 Set Wsh = CreateObject("WScript.Shell") RetVal = Wsh.Popup(Msg, Secs, Title, vbInformation + vbOKOnly) Set Wsh = Nothing End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45231 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry Leith, it did not work. I have to click "OK" for it to close...
-- Thank you... "Leith Ross" wrote: Hello EXCELMACROS, Here is macro to close the dialog after 5 seconds. You can change this to suite your needs. Code: -------------------- Sub TimedMsgBox() Dim Msg As String Dim Secs As Long Dim Wsh As Object Title = "Test" Msg = "This will close in 5 seconds." Secs = 5 Set Wsh = CreateObject("WScript.Shell") RetVal = Wsh.Popup(Msg, Secs, Title, vbInformation + vbOKOnly) Set Wsh = Nothing End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45231 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set a reference to Windows Script Host Object Model (Tools References).
Copy and paste the TimedMsgBox code and try it. It works for me. -- I am running on Office 2003, unless otherwise stated. "EXCELMACROS" wrote: Sorry Leith, it did not work. I have to click "OK" for it to close... -- Thank you... "Leith Ross" wrote: Hello EXCELMACROS, Here is macro to close the dialog after 5 seconds. You can change this to suite your needs. Code: -------------------- Sub TimedMsgBox() Dim Msg As String Dim Secs As Long Dim Wsh As Object Title = "Test" Msg = "This will close in 5 seconds." Secs = 5 Set Wsh = CreateObject("WScript.Shell") RetVal = Wsh.Popup(Msg, Secs, Title, vbInformation + vbOKOnly) Set Wsh = Nothing End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45231 |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The WScript.Shell - popup method is not reliable to dismiss a msgbox. It may
work in some machines, not at all, or erratically (does not seem to relate to windows version). Best way is make a userform to look like a msgbox, perhaps pass a message to a label caption and include some sort of timer to dismiss the form if still showing after say 5 seconds, eg ' userform code Private mbShow As Boolean Private Sub UserForm_Activate() Dim t As Single Dim ShowTime As Single mbShow = True ShowTime = 5 t = Timer While (Timer < ShowTime + t) And mbShow DoEvents Wend If mbShow Then Unload Me End If End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) mbShow = False End Sub Regards, Peter T "EXCELMACROS" wrote in message ... Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This method worked, thank you MIKE ; LEITH ; ORION and PETER
-- Thank you... "Peter T" wrote: The WScript.Shell - popup method is not reliable to dismiss a msgbox. It may work in some machines, not at all, or erratically (does not seem to relate to windows version). Best way is make a userform to look like a msgbox, perhaps pass a message to a label caption and include some sort of timer to dismiss the form if still showing after say 5 seconds, eg ' userform code Private mbShow As Boolean Private Sub UserForm_Activate() Dim t As Single Dim ShowTime As Single mbShow = True ShowTime = 5 t = Timer While (Timer < ShowTime + t) And mbShow DoEvents Wend If mbShow Then Unload Me End If End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) mbShow = False End Sub Regards, Peter T "EXCELMACROS" wrote in message ... Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No problem. I was hoping to avoid the userform route, but if that's the only
way, then it must be done. -- I am running on Office 2003, unless otherwise stated. "EXCELMACROS" wrote: This method worked, thank you MIKE ; LEITH ; ORION and PETER -- Thank you... "Peter T" wrote: The WScript.Shell - popup method is not reliable to dismiss a msgbox. It may work in some machines, not at all, or erratically (does not seem to relate to windows version). Best way is make a userform to look like a msgbox, perhaps pass a message to a label caption and include some sort of timer to dismiss the form if still showing after say 5 seconds, eg ' userform code Private mbShow As Boolean Private Sub UserForm_Activate() Dim t As Single Dim ShowTime As Single mbShow = True ShowTime = 5 t = Timer While (Timer < ShowTime + t) And mbShow DoEvents Wend If mbShow Then Unload Me End If End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) mbShow = False End Sub Regards, Peter T "EXCELMACROS" wrote in message ... Hello, me again.., I'm trying to close a msgbox using application.ontime now + 5seg Thank you in advance -- Thank you... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Msgbox Close with vba | Excel Programming | |||
close msgbox | Excel Programming | |||
Msgbox Close Button | Excel Programming | |||
Close msgbox ? | Excel Programming | |||
Close a MsgBox | Excel Programming |