ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Splash Screen Behavior (https://www.excelbanter.com/excel-programming/419460-splash-screen-behavior.html)

al

Splash Screen Behavior
 
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?

--
Al C

Jim Cone[_2_]

Splash Screen Behavior
 
(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?
--
Al C

Peter T

Splash Screen Behavior
 
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


"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?

--
Al C





All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com