VBA Excel MsgBox


Posted by Ken Brading on January 17, 2002 9:47 AM

I'm looking for a command I can execute in the
Workbook_Open macro that will display a message box
that informs the user but does not require them to
select "OK" or otherwise respond. The message would
simply be displayed for 2 or 3 seconds then disappear.

I looked in John Walkenback's book but find nothing
that doesn't require a user response.

Ken Brading

Posted by faster on January 17, 2002 10:17 AM


It sounds like you want a "Splash Screen". Like a form
with a timer, that closes when the timer reaches
x seconds.

Posted by Ken Brading on January 17, 2002 10:28 AM

Can you give me an example or tell me where I can
read about this command?
Ken

Posted by faster on January 17, 2002 10:50 AM


Create a form called UserForm1. Paste this code
in the forms module. Make this form open with Excel's
on open call.


Private Sub UserForm_Activate()
Dim MyHour, MyMinute, MySecond, MyWait

MyHour = Hour(Now())
MyMinute = Minute(Now())
MySecond = Second(Now()) + 3
MyWait = TimeSerial(MyHour, MyMinute, MySecond)
Application.Wait MyWait

End
End Sub

Posted by faster on January 17, 2002 10:58 AM

Show the Form

MyHour = Hour(Now()) MyMinute = Minute(Now()) MySecond = Second(Now()) + 3 MyWait = TimeSerial(MyHour, MyMinute, MySecond) Application.Wait MyWait End

This will show the form, place it in the ThisWorkbook
module.


Private Sub Workbook_Open()
UserForm1.Show
End Sub

Posted by Ken Brading on January 17, 2002 11:17 AM

MyHour = Hour(Now()) MyMinute = Minute(Now()) MySecond = Second(Now()) + 3 MyWait = TimeSerial(MyHour, MyMinute, MySecond) Application.Wait MyWait End

I have very little experience with userforms.
Hopefully after I read up on them I will be
able to make this work. Thank you.
Ken
this work



Posted by faster on January 17, 2002 11:35 AM

This may help

MyHour = Hour(Now()) MyMinute = Minute(Now()) MySecond = Second(Now()) + 3 MyWait = TimeSerial(MyHour, MyMinute, MySecond) Application.Wait MyWait End

Go into the Visual Basic Editor. From the menu select
Insert/User Form. Double click the user form to
see the code area of it. Paste the above Activate
code in the form's code area.

Design the form using the toolbox. Drag and drop
a label onto the form. Type your message on the label.