Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Put a timer on a MsgBox?

10 views
Skip to first unread message

Joe 90

unread,
Jul 10, 2003, 6:00:54 PM7/10/03
to
Is vba able to put a timer on a MSgBox, so that OK is "clicked" after a
specified time and a macro/code can continue?

I have tried allsorts but with Msgbox one seems to get complete freezing of
the app and vba.

Any help much appreciated.

Joe


Bob Phillips

unread,
Jul 10, 2003, 6:13:38 PM7/10/03
to
Joe,

Use a custom form, and set the OnTime method when you initialise it to call
a proc that times out.

See OnTime in Help for details of that method.

--

HTH

Bob Phillips

"Joe 90" <j...@bimma.me.uk> wrote in message
news:3f0de1e3$1...@mk-nntp-2.news.uk.tiscali.com...

Joe 90

unread,
Jul 10, 2003, 6:36:14 PM7/10/03
to
Thanks Bob, I guess you have answered my question. I was trying to avoid
custom forms but if that's the only way to go, I'll go that way :)

Joe

"Bob Phillips" <bob.ph...@tiscali.co.uk> wrote in message
news:OlQuECzR...@TK2MSFTNGP11.phx.gbl...

Chip Pearson

unread,
Jul 10, 2003, 9:12:23 PM7/10/03
to
Joe,

Set a reference to "Windows Script Host Object Model" and then use
code like

Dim SH As IWshRuntimeLibrary.WshShell
Set SH = New IWshRuntimeLibrary.WshShell
SH.Popup "Hello World", 5, "Title", vbYesNo

This will show a message box for 5 seconds, and then disappear,
returning the default value (Yes, in this example).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com

"Joe 90" <j...@bimma.me.uk> wrote in message
news:3f0de1e3$1...@mk-nntp-2.news.uk.tiscali.com...

Chip Pearson

unread,
Jul 10, 2003, 10:37:03 PM7/10/03
to
> returning the default value (Yes, in this example).

Not correct. If the Popup times out with no user input, the
result is -1. Sorry for any confusion.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com ch...@cpearson.com

"Chip Pearson" <ch...@cpearson.com> wrote in message
news:O%239Z%23l0RD...@tk2msftngp13.phx.gbl...

Joe 90

unread,
Jul 11, 2003, 6:50:04 PM7/11/03
to
Chip

Many thanks, I'll give it a whirl!

Joe

"Chip Pearson" <ch...@cpearson.com> wrote in message

news:OMhKSV1R...@TK2MSFTNGP11.phx.gbl...

Alain CROS

unread,
Jul 12, 2003, 12:31:55 PM7/12/03
to
Hi.

Try that.

Sub TimedMessage()
Const Title As String = "Self closing message box"
Const Delay As Byte = 2 ' Tps d'affichage en secondes
Const wButtons As Integer = 16 ' Boutons + icone
Dim wsh As Object, msg As String
Set wsh = CreateObject("WScript.Shell")
msg = Space(10) & "Bonjour," & vbLf & vbLf & "Nous sommes le " & Date
wsh.Popup msg, Delay, Title, wButtons
Set wsh = Nothing
End Sub

If you want no button
set Const wButtons As Integer = 7 + 16

Alain CROS.

"Joe 90" <j...@bimma.me.uk> a écrit dans le message de news: 3f0de1e3$1...@mk-nntp-2.news.uk.tiscali.com...

0 new messages