C screenupdating word

' This includes both posting free demo projects made from this ' code as well as reproducing the code in text or html format.' --------------------------------------------------------------------------------' User Defined Error codes Const ERR_NO_WINDOW_HANDLE As Long = 1000 Const ERR_WINDOW_LOCK_FAIL As Long = 1001 Const ERR_VERSION_NOT_SUPPORTED As Long = 1002 ' API declarations for Find Window() & Lock Window Update() ' Use Find Window API to locate the Power Point handle. scid=kb;en-us;313104 range Found = container Range.

c screenupdating word-85

Many times the macro may do quite a bit with the document, such as jumping to different places, replacing text, and taking other types of actions.

This means that the Word screen can look like it has "gone crazy" while the macro is running.

One thing you may want to do with your macro to make it run faster and to prevent distracting flashes on the screen is to turn off screen updating while the macro is running.

The following macro lines will, respectively, turn off screen updating and then turn it back on in a VBA macro.

I've got a word 2013 macro which is taking quite some time to finish.

The macro is reformatting the document and the Screen keeps updating while the macro is running, which I guess is where word spends most of it's time.

The idea is to use the first line near the beginning of your macro, and then use the second line near the end.

Thus, the main body of your macro can do its work behind the scenes without the necessity of stopping to update the screen.

The routine also illustrates the use of the Screen Updating property (code listed above).

' --------------------------------------------------------------------------------Sub Open PPSFor Edit() On Error Go To Err Handle Dim p Show As Presentation ' Lock the window to prevent refreshing ' See above article example for the code Screen Updating = False 'Open the show, however use additional flag - With Window set to FALSE Set p Show = Presentations.

' -------------------------------------------------------------------------------- ' Copyright 1999-2015, Shyam Pillai, All Rights Reserved.

Tags: , ,