My code is working properly up until the point when I want to unload the newly generated form.
I have 2 timers :: 1 for load the splash form and 1 for unload the splash form.
Option Explicit
Private frmSplash As Form
Private Sub splashForm()
Set frmSplash = New myForm
With frmSplash
.Width = 4000
.Height = 3000
.Caption = "Splash"
End With
frmSplash.Show vbModal
unloadSplash.Enabled = True
End Sub
Private Sub Form_Activate()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
splashTimer.Enabled = True
End Sub
Private Sub splashTimer_Timer()
splashForm
End Sub
Private Sub unloadSplash_Timer()
'MsgBox "Am I alive ?"
Unload frmSplash
Set frmSplash = Nothing
unloadSplash.Enabled = False
splashTimer.Enabled = False
End Sub
Seems like unloadSplash_Timer
is not enabled after splashTimer.Enabled = True
...
The "vbModal" stop your code in that command. You must to move the timer of unload splash form in to the splash form.
The events order is this:
-> sub Form_Activate
-> sub splashTimer_Timer
-> sub splashForm
---> frmSplash.Show vbModal (here the code stop until your form is not unload)
/* If you close manualy the "frmSplash" the the timer "unloadSplash" start. */