Vb net screenupdating

Article contributed by Daryl Lucas Many people know they can speed execution of Word Automation by turning off screen updating: Word. Screen Updating = False Many do not know, however, that they can get an even greater speed boost by hiding the application altogether.

Here is an example from a Visual Basic client: In the above example, Word launches but does not appear anywhere on the screen. (It does, though, show up in NT's Task Manager, in its list of running processes.) Despite this apparent lack of response, Word is very active and quite capable of doing everything it is told-creating a new document, inserting the message, , saving the file, closing it, and quitting.

The functionality depends on Word, not on the Automation client.

But it also works even if you run your Automation code from Word itself.

but in the informal testing I've done, I've found that Visible = False makes Word work roughly 15% faster than Screen Updating = False does on identical tasks.

That's about 1 second for every 7-not a trivial amount if your job runs longer than that. Chief among them is that repagination routines don't work when Word is invisible.

Check out Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? If you use a later version of Word, visit our Word Tips site focusing on the ribbon interface.

Many people write their own macros to manipulate the information in a workbook.The following macro lines will, respectively, turn off screen updating and then turn it back on in a VBA macro.The idea is to use the first line near the beginning of your macro, and then use the second line near the end.Application object and replace them with invisibility lines: Notice that you want to put the Word. Visible = True line in an error-handler or in a spot where you know it will be run if something goes awry. (If you do get stuck with an invisible Word in the middle of a crash, you can launch the Task Manager and kill the WINWORD.EXE process.) How much of a difference does invisibility make?You can verify this by launching Word the old-fashioned way and opening File1 at the bottom of the File menu after running the sample code.

Tags: , ,