Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splash Screen? 1

Status
Not open for further replies.

Alcedes

Technical User
Mar 25, 2008
46
US
My visio document executes a large amount of code at start up which causes a long load time. (30s-1m15s, depending on the system) and I was thinking it would be nice to add a splash screen to allow the user to see that the program is actually working and simply inform them that there is a long laod time.

The problem is, the only way I know to do this is by adding a form and calling it. The problem with that is that the visio code does not execute while the focus is set on this form.

Any ideas on what i can do?
 
The problem with that is that the visio code does not execute while the focus is set on this form."

If I understand you correctly, the form appears but the code doesn't execute until the form is closed? If so, you need to change the form's ShowModal property to False. Usually in VB6, Access, etc. this property is off by default, but in Visio, it's set by default.

With ShowModal = False, the following code should display the splash screen and run the loop at the same time.
Code:
Private Sub Document_DocumentOpened(ByVal doc As IVDocument)
Dim i As Integer

    Load UserForm1
    UserForm1.Show

    For i = 1 To 32766
        DoEvents
    Next

    MsgBox "done"
End Sub
 
I cant believe how difficult it is to make a splash screen in vba. :(

I have the form loading and everything...the problem is that it wont actually load the forms graphics until all the code has run. It loads as directed. then shows itself. but it is nothing but a white form.

then once my code has completed, my image shows up. What a headache. :(
 
Yeah, I'm not a huge fan of VBA, but all languages have their idiosyncrasies. Java can be a pain too, especially with Swing GUIs. Too bad VBA wasn't more like VB6, or better yet, they could replace it altogether with VB.Net or C#.

As for the image on your form, I haven't tried to create a splash screen in VBA, but there's probably a way to load the image first. Did you call "Load Form" before calling "Form.Show"? If so, try placing the image loading code as the first part of your processing code. Make sure that if you're doing any fancy looping that you include DoEvents to allow other threads/processes to run while your code is off doing whatever it's doing. Finally, if all else fails, try loading the image in using a low-level API call... I think the Windows API has something for loading bitmap images.
 
I never did get this on figured out. :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top