Jumping Windows

O

Oz Springs

When I run some macros, the document window jumps quite a lot.

In FileMaker there is a command called ³Freeze Window² which gives the
impression that nothing is happening while the script is doing various
things. Is there an equivalent for Word? I¹ve looked for ³Freeze window² in
VB Help but that¹s not the right phrase and I don¹t know what to look for in
VB

Thanks for any help




Oz
 
F

Fredrik Wahlgren

Oz Springs said:
When I run some macros, the document window jumps quite a lot.

In FileMaker there is a command called ³Freeze Window² which gives the
impression that nothing is happening while the script is doing various
things. Is there an equivalent for Word? I¹ve looked for ³Freeze window² in
VB Help but that¹s not the right phrase and I don¹t know what to look for in
VB

Thanks for any help




Oz

In Excel, you can do this:
application.screenupdate = false

Maybe you can do the same in Word.

/ fredrik
 
J

John McGhie

Yes. Application.screenupdating = False

It also results in a substantial performance improvement because it disables
the display code, which occupies something like 80 per cent of the CPU time
when Word is working.

Warning: There's another one: application.visible = false
You can use that to get a really serious performance improvement. But if
you do, be aware that things like ActiveDocument and Selection all become
Null, because no document is "active". It also leads to some disconcerting
user behaviour because they shut the lid and walk away half-way through your
long batch job :)

If you are going to muck around with this, tell us what you are doing:
there's a few traps for the unwary. It's often better to set the View to
Normal View, which uses a lot less horsepower but retains the ability to
show the user there is something happening.

Hope this helps

When I run some macros, the document window jumps quite a lot.

In FileMaker there is a command called ³Freeze Window² which gives the
impression that nothing is happening while the script is doing various
things. Is there an equivalent for Word? I¹ve looked for ³Freeze window² in
VB Help but that¹s not the right phrase and I don¹t know what to look for in
VB

Thanks for any help




Oz

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 
O

Oz Springs

Thank you for this advice. It works in my macro and does improve performance
- so long as at another point I add

Application.screenupdating = True

Otherwise poor old Word crashes...

Kind regards



Oz
 
J

John McGhie

Hmmm... You're not supposed to "need" to turn it back on. It should
automatically come back when your procedure ends or passes out of scope.

However, it's good practice to do it.

What I am saying is that the crash is caused by something else, which gets
fixed by the pagination that happens when you turn Screen Updating back on.

If you are programmatically making a lot of edits to a document, it's also a
good idea to use ActiveDocument.UndoClear every now and again, otherwise you
will overflow the Undo Buffer and Word may crash.

I usually set an iteration counter and use MOD 100 = 0 to tell me to clear
the undo buffer and save. Leads to a long and healthy life. Do it every
ten iterations if you are running Find/Replace All's...

Cheers


Thank you for this advice. It works in my macro and does improve performance
- so long as at another point I add

Application.screenupdating = True

Otherwise poor old Word crashes...

Kind regards



Oz

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Consultant Technical Writer
Sydney, Australia +61 4 1209 1410
 

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