Splash Screen continued.....

M

Mary

Thanks for the advice Steve, It certainly makes the screen
easier on the eye by adding the command

Application.ScreenUpdating = False

I would still like the splash screen however (see
yesterday's post), please could someone advise me on this.

Thanks very much.

Mary.
 
M

Malcolm Smith

Mary

Why not create the user form object in a modeless manner and then when the
code has completed whatever its supposed to have done then Unload the form
object.

Again, don't use magic forms. For this sort of thing it would be best to
make an INSTANCE of the form class and work with that.

I do this sort of stuff all the time, particularly in VB applications when
I am setting up the application's data structures or taking to remove
servers.

Hope this helps
- Malc
 
M

Mary

Hi Malc

Many Thanks for your response, I have tried:-

splashform.show
(this waits until I click the form, then hides the form
then begins the procedure)

I have also tried,
splashform.show vbmodeless
(this hides the form almost immediately as the procedure
starts)

I know I am so near to a solution but it just doesn't want
to play!!

Thanks

Kerry.
 
J

Jonathan West

Mary said:
Hi Malc

Many Thanks for your response, I have tried:-

splashform.show
(this waits until I click the form, then hides the form
then begins the procedure)

I have also tried,
splashform.show vbmodeless
(this hides the form almost immediately as the procedure
starts)

I know I am so near to a solution but it just doesn't want
to play!!

The way to do this is as follows

1. Take out all the code you had in the userForm_Activate event. It isn't
needed.

2. When you want to show the spash screen, use the following line of code

splashform.show vbmodeless

3. When you want to stop showing it, use this line of code

Unload splashform
 
M

Malcolm Smith

Mary

This is because you are using Magic Forms. You HAVE to create an instance
of a form as you would any other object.

I would never recommend that you do something like:
<Class>.Show


See rants passim on this subject.

What you ought to do is something like this (this is been done nowhere
near a compiler so excuse any silly errors).


Dim oSplashForm as frmSplashForm


set osplashform = New frmSplashform

oSplashform.Show vbModeless
doevents ' to make sure that screen is repainted

'do lots of stuff which you wish to do

unload oSplashform
set oSplashform = Nothing


This is how ALL of your forms should be created. Please don't use Magic
Forms as you will have less control over them and I have seen problems
with them creep in from time to time. It is good practice to always
instantiate your objects explicitly.

Hope that this helps
- Malc
www.dragondrop.com
 
M

Mary

Hi Jonathan

Many thanks, it still doesn't work. I think it is down
to the fact that new documents are being created with
header & footer detail being inserted, custom fields are
being updated etc. there are a lot of things going on
through the procedure requiring active window and active
document commands. I think I have to abandon the
Splashform idea.

Thank you for your time.

Mary
-----Original Message-----



The way to do this is as follows

1. Take out all the code you had in the
userForm_Activate event. It isn't
 
J

Jonathan West

You could try adding the following lines immediately after the
splashform.Show vbmodeless command

splashform.Repaint
DoEvents
DoEvents
DoEvents
DoEvents


The Doevents commands tell word to release the processor for a moment to
allow Windows to service the message queue - i.e. the list of things it has
to do. Screen redrawing commands are part of the message queue, and so this
will probably help ensure that the splash form gets displayed on time even
though there is lots going on in the background.

I've suggested including several DoEvents commands because drawing a form
requires drawing several separate elements - the form, the coption etc, each
of which is implemented "under the hood" as a separate Windows message. Just
having a single DoEvents command may not enable the whole of the from to be
displayed.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 
S

Steve Lang

Hi Mary,

I noticed that you are using active window and active document. That may be
your issue. Instead of using activedocument stuff, dimension a document
variable and use that. That way, the focus can remain with the document that
contains the form you want to keep visible.

You can even process your documents invisibly if you use a document variable

Simple example below (not compiled, so some syntax may be off)

Sub foo
Dim myDoc as Document
Set myDoc = documents.add(template:= "C:\Templates\MyTemplate.dot",
visible:= False)

'do stuff to myDoc
myDoc.Save
myDoc.close
Set myDoc = Nothing
End sub
 

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

Top