Splash screen that won't Unload

saltire1963

Board Regular
Joined
Aug 11, 2014
Messages
65
I've created a splash screen that opens when the workbook opens as planned, but does not unload after the required 3 seconds, it just stays open and does not seem to call the Sub that should close it. I'm using the code Application.OnTime Now + TimeValue("00:00:03"), "UnloadSplash" , and UnloadSplash is a Sub I have created in a general VBA module. Can anyone point me in the right direction or suggest what I can try to fix?
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,493
Office Version
365, 2010
Platform
Windows
You might try only putting the code to show the splash screen in the Workbook Module and put your timer and unload commands in the userform module. You may have to create an additional unload sub in a code module which is called from the userform.
 

saltire1963

Board Regular
Joined
Aug 11, 2014
Messages
65
Yes, that is what I have done, but it doesn't work. I have since tried changing the code in the userform module from Sub frmSplash_Initialize() to UserForm_Initialize() and it comes up with an error message saying"Cannot run the macro....... The macro may not be available in this workbook or all macros may be disabled" which I cannot explain
 

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,493
Office Version
365, 2010
Platform
Windows
We can't be talking about a lot of code here. Probably the best thing for you to do would be to post your code...
 

saltire1963

Board Regular
Joined
Aug 11, 2014
Messages
65
OK, in ThisWorkbook module I have:Private Sub Workbook_Open()
frmSplash.Show
End Sub

In the UserForm module I have:

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

In a general VBA module I have:
Sub UnloadSplash()
Unload frmSplash
End Sub
 

saltire1963

Board Regular
Joined
Aug 11, 2014
Messages
65
igold, don't know what I've done, but now its working, thanks for taking the time my friend
 

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,493
Office Version
365, 2010
Platform
Windows
I am glad it is working. I don't think I had anything to do with it, but either way, thanks for the feedback!
 

Watch MrExcel Video

Forum statistics

Threads
1,095,243
Messages
5,443,311
Members
405,227
Latest member
Ankit Jain

This Week's Hot Topics

Top