Group:  Microsoft Excel ยป microsoft.public.excel.programming
Thread: Close msgbox automatically

Close msgbox automatically
EXCELMACROS 12/30/2008 6:26:12 PM
Hello, me again.., I'm trying to close a msgbox using application.ontime now
+ 5seg

Thank you in advance
--
Thank you...
RE: Close msgbox automatically
Mike H 12/30/2008 6:42:08 PM
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:

[Quoted Text]
> Hello, me again.., I'm trying to close a msgbox using application.ontime now
> + 5seg
>
> Thank you in advance
> --
> Thank you...
RE: Close msgbox automatically
EXCELMACROS 12/30/2008 6:47:13 PM
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:

[Quoted Text]
> 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...
RE: Close msgbox automatically
Mike H 12/30/2008 6:50:17 PM
I think you need to go back and read my post again.

[Quoted Text]
> > 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...
RE: Close msgbox automatically
EXCELMACROS 12/30/2008 6:56:04 PM
Well, I did copy paste exactly what you suggested and is not closing in 5
seg...
--
Thank you...


"Mike H" wrote:

[Quoted Text]
> 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...
Re: Close msgbox automatically
Leith Ross <Leith.Ross.3l8xdq[ at ]thecodecage.com> 12/30/2008 7:11:16 PM
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/showthread.php?t=45231
RE: Close msgbox automatically
Mike H 12/30/2008 7:17:00 PM
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:

[Quoted Text]
> 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...
RE: Close msgbox automatically
EXCELMACROS 12/30/2008 7:21:36 PM
Sorry Mike, It won't close until I press "OK" Thank you so much for your
help...
--
Thank you...


"Mike H" wrote:

[Quoted Text]
> 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...
Re: Close msgbox automatically
EXCELMACROS 12/30/2008 7:27:09 PM
Sorry Leith, it did not work. I have to click "OK" for it to close...
--
Thank you...


"Leith Ross" wrote:

[Quoted Text]
>
> 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/showthread.php?t=45231
>
>
Re: Close msgbox automatically
"Peter T" <peter_t[ at ]discussions> 12/30/2008 7:51:50 PM
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" <EXCELMACROS[ at ]discussions.microsoft.com> wrote in message
news:8DDCE026-32F0-4639-812F-8BFF2F047D27[ at ]microsoft.com...
[Quoted Text]
> Hello, me again.., I'm trying to close a msgbox using application.ontime
> now
> + 5seg
>
> Thank you in advance
> --
> Thank you...


Re: Close msgbox automatically
Orion Cochrane 12/30/2008 8:30:34 PM
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:

[Quoted Text]
> 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/showthread.php?t=45231
> >
> >
Re: Close msgbox automatically
Mike H 12/30/2008 8:36:57 PM
Hi,

In XL2003, I can run the solution posted by me and the one by Leith without
setting this reference.

Mike

"Orion Cochrane" wrote:

[Quoted Text]
> 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/showthread.php?t=45231
> > >
> > >
Re: Close msgbox automatically
Orion Cochrane 12/30/2008 8:44:54 PM
I took the reference out, and it worked as well for me too.
--
I am running on Office 2003, unless otherwise stated.


"Mike H" wrote:

[Quoted Text]
> Hi,
>
> In XL2003, I can run the solution posted by me and the one by Leith without
> setting this reference.
>
> Mike
>
> "Orion Cochrane" wrote:
>
> > 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/showthread.php?t=45231
> > > >
> > > >
Re: Close msgbox automatically
EXCELMACROS 12/30/2008 8:51:00 PM
Thank you all, I'm also on XL2003, very weird I'll try on a different
computer tonight and let you know...
--
Thank you...


"Orion Cochrane" wrote:

[Quoted Text]
> I took the reference out, and it worked as well for me too.
> --
> I am running on Office 2003, unless otherwise stated.
>
>
> "Mike H" wrote:
>
> > Hi,
> >
> > In XL2003, I can run the solution posted by me and the one by Leith without
> > setting this reference.
> >
> > Mike
> >
> > "Orion Cochrane" wrote:
> >
> > > 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/showthread.php?t=45231
> > > > >
> > > > >
Re: Close msgbox automatically
EXCELMACROS 12/30/2008 9:21:41 PM
This method worked, thank you MIKE ; LEITH ; ORION and PETER
--
Thank you...


"Peter T" wrote:

[Quoted Text]
> 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" <EXCELMACROS[ at ]discussions.microsoft.com> wrote in message
> news:8DDCE026-32F0-4639-812F-8BFF2F047D27[ at ]microsoft.com...
> > Hello, me again.., I'm trying to close a msgbox using application.ontime
> > now
> > + 5seg
> >
> > Thank you in advance
> > --
> > Thank you...
>
>
>
Re: Close msgbox automatically
"Peter T" <peter_t[ at ]discussions> 12/30/2008 9:22:28 PM
Not weird, no need to be surprised if it doesn't work for you as I tried to
explain in my other post.

The reference is not required if using late binding and createobject, but
that's not the issue.

Regards,
Peter T

"EXCELMACROS" <EXCELMACROS[ at ]discussions.microsoft.com> wrote in message
news:F6764C26-192E-427F-85E9-BDC5E0F33E0B[ at ]microsoft.com...
[Quoted Text]
> Thank you all, I'm also on XL2003, very weird I'll try on a different
> computer tonight and let you know...
> --
> Thank you...
>
>
> "Orion Cochrane" wrote:
>
>> I took the reference out, and it worked as well for me too.
>> --
>> I am running on Office 2003, unless otherwise stated.
>>
>>
>> "Mike H" wrote:
>>
>> > Hi,
>> >
>> > In XL2003, I can run the solution posted by me and the one by Leith
>> > without
>> > setting this reference.
>> >
>> > Mike
>> >
>> > "Orion Cochrane" wrote:
>> >
>> > > 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/showthread.php?t=45231
>> > > > >
>> > > > >


Re: Close msgbox automatically
Orion Cochrane 12/30/2008 9:42:37 PM
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:

[Quoted Text]
> 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" <EXCELMACROS[ at ]discussions.microsoft.com> wrote in message
> > news:8DDCE026-32F0-4639-812F-8BFF2F047D27[ at ]microsoft.com...
> > > Hello, me again.., I'm trying to close a msgbox using application.ontime
> > > now
> > > + 5seg
> > >
> > > Thank you in advance
> > > --
> > > Thank you...
> >
> >
> >
Re: Close msgbox automatically
JLGWhiz 12/31/2008 1:25:01 AM
Works for me too, Mike. Must be something in the OP settings that prevents
it from executing.

"Mike H" wrote:

[Quoted Text]
> Hi,
>
> In XL2003, I can run the solution posted by me and the one by Leith without
> setting this reference.
>
> Mike
>
> "Orion Cochrane" wrote:
>
> > 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/showthread.php?t=45231
> > > >
> > > >
Re: Close msgbox automatically
Gord Dibben <gorddibbATshawDOTca> 12/31/2008 4:46:25 PM
Doesn't work for me in my 2003 setup.

The msgbox appears on the screen and also as a new entry(Test) on my
Taskbar??

But never closes on its own.


Gord Dibben MS Excel MVP

On Tue, 30 Dec 2008 17:25:01 -0800, JLGWhiz
<JLGWhiz[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>Works for me too, Mike. Must be something in the OP settings that prevents
>it from executing.
>
>"Mike H" wrote:
>
>> Hi,
>>
>> In XL2003, I can run the solution posted by me and the one by Leith without
>> setting this reference.
>>
>> Mike
>>
>> "Orion Cochrane" wrote:
>>
>> > 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/showthread.php?t=45231
>> > > >
>> > > >

Home | Search | Terms | Imprint
Newsgroups Reader