Splash screen

Z

zkid

Can anyone tell me how to create a splash screen that works? I've tried the
DoEvents code, and the OnTime code. With DoEvents, I couldn't even get the
userform to show. With the OnTime code, the userform just stays on the
screen and the kill macro doesn't kick in (and yes, I tried with the full
project and module name too). Arg!
 
J

Jay Freedman

Can anyone tell me how to create a splash screen that works? I've tried the
DoEvents code, and the OnTime code. With DoEvents, I couldn't even get the
userform to show. With the OnTime code, the userform just stays on the
screen and the kill macro doesn't kick in (and yes, I tried with the full
project and module name too). Arg!

See http://www.word.mvps.org/FAQs/Userforms/CreateASplashScreen.htm.

If you still can't get it to work, post *both* the code in your
userform and the macro that calls the userform.

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

zkid

Thanks, Jay.

The url you provided is the exact site from which I obtained the "DoEvents"
code. I'm using the exact same code as below. The only difference is that
it is being called from a regular sub, not something to occur at Word open.
Thanks.

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

Private Sub UserForm_Activate()
DoEvents
' Set the display time in milliseconds
Sleep 5000
Unload Me
End Sub

In a code Module:

Public Sub AutoNew() 'Instead of this, it is just a regular sub
UserForm1.Show
End Sub
 
J

Jay Freedman

Mystery time...

I made a userform in a blank document, using the default name
UserForm1 (since that's what the macro calls), and put only an image
control on it. I pasted your code into the userform code window
without changes. I made a module in the same document and pasted your
macro into it, changing the subroutine name to Foo (my favorite).

Running the macro out of the editor with F5 or from the Macros dialog,
it worked as it's supposed to.

Now I'm wondering what other conditions might be causing your problem.
How is your macro security level set (Tools > Macro > Security)? What
other programs are running? What's on the surface of your userform?
What happens if you stick a MsgBox statement in the userform before or
after the DoEvents? What happens if you replace the DoEvents with
Me.Repaint?

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

Tony Jollans

Where is the procedure you are using instead of AutoNew and how are you
invoking it?
 
Z

zkid

Thanks guys.

The problem, apparently, is that instead of Unload Me, I used Unload
Userform1. Guess it doesn't like that.

Thanks for your responses.

zkid
 

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