Splash Screen Behavior

A

Al

XL2003 on XP

I have a UserForm set up as a splash screen that fires with WorkBook code:

Private Sub Workbook_Open()
Userform1.Show
End Sub

Sub KillForm()
Unload Userform1
End Sub

And the code behind the UserForm:

Private Sub UserForm_Initialize()
Application.OnTime Now + TimeValue("00:00:06"), "KillForm"
End Sub

If the user kills the splash screen before it times out, and then closes the
application without closing the instance of Excel, the application will start
up again after the selected time out period. After that, even if the splash
screen times out, this repeats when you try to close only the application.

Can anyone explain what causes this effect?
 
J

Jim Cone

(untested)
In the UserForm_QueryClose event, add a copy of the ontime procedure
with the Schedule parameter set to False.
--
Jim Cone
Portland, Oregon USA



"Al"
wrote in message
XL2003 on XP
I have a UserForm set up as a splash screen that fires with WorkBook code:

Private Sub Workbook_Open()
Userform1.Show
End Sub

Sub KillForm()
Unload Userform1
End Sub

And the code behind the UserForm:

Private Sub UserForm_Initialize()
Application.OnTime Now + TimeValue("00:00:06"), "KillForm"
End Sub

If the user kills the splash screen before it times out, and then closes the
application without closing the instance of Excel, the application will start
up again after the selected time out period. After that, even if the splash
screen times out, this repeats when you try to close only the application.
Can anyone explain what causes this effect?
 
P

Peter T

At the top of a normal module, say same as the one that contains "KillForm"

Public gdtMyOnTime As Date

' add a new line to Sub KillForm

Sub KillForm()
gdtMyOnTime = 0
Unload Userform1
End Sub

in the form

Private Sub UserForm_Initialize()
gdtMyOnTime = Now + TimeValue("00:00:06")
Application.OnTime gdtMyOnTime, "KillForm"
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If mdtMyOnTime Then
Application.OnTime gdtMyOnTime , "KillForm", schedule:=False
End If
End Sub


Regards,
Peter T
 

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

Similar Threads


Top