Timed Display of UserForm

J

Jack_Feeman

I have done this in Excel using the Application.OnTime command but that does
not work in Word 2003.
I want to display an UserForm on the opening of a Word Document (form) for a
specified period of time. Is there a way to do this?
I tried bring up a msgbox and input box to no avail. Can I use an loop to
take it through a cycle3 and then close it?

Thanks
Jack
 
J

Jean-Guy Marcil

Jack_Feeman was telling us:
Jack_Feeman nous racontait que :
I have done this in Excel using the Application.OnTime command but
that does not work in Word 2003.
I want to display an UserForm on the opening of a Word Document
(form) for a specified period of time. Is there a way to do this?
I tried bring up a msgbox and input box to no avail. Can I use an
loop to take it through a cycle3 and then close it?

Thanks
Jack

See
http://word.mvps.org/faqs/userforms/CreateASplashScreen.htm

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jay Freedman

Jack_Feeman said:
I have done this in Excel using the Application.OnTime command but
that does not work in Word 2003.
I want to display an UserForm on the opening of a Word Document
(form) for a specified period of time. Is there a way to do this?
I tried bring up a msgbox and input box to no avail. Can I use an
loop to take it through a cycle3 and then close it?

Thanks
Jack

You can use the technique shown at
http://www.word.mvps.org/FAQs/Userforms/CreateAProgressBar.htm. If the user
doesn't have to interact with the userform at all, but just look at it while
something happens in the background (like a splash screen), then replace the
For loop with a call to the the Sleep function in the Win32 API:

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Sleep 5000

would make the userform last for 5 seconds.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
P

Perry

Plain VBA in a Userform code module:


Private TimeToSayGoodbye

Private Sub UserForm_Activate()
Do Until Timer - TimeToSayGoodbye > 5
DoEvents
Loop
Unload Me
End Sub

Private Sub UserForm_Initialize()
TimeToSayGoodbye = Timer
End Sub


--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top