You'll be able to ask any tech support questions, or chat with the community and help others.
Hey, I am building a word document from scratch, using a macro (actually, using the Microsoft Word Object Library 10) as in this link: uses the same macro language as in the VBA backend of microsoft word. However, maybe it's not so surprising, since it actually IS running in the background (on a new instance of Word), no screen updates. NET code (adapted from that codeproject example) seems to do is start an instance of Microsoft Word in the background, and then it builds the document and saves it to a specified filename, all invisibly. Screen updating can slow things down, so you can turn it off at the beginning.
Are you looking for the solution to your computer problem? This site is completely free -- paid for by advertisers and donations.
If you're not already familiar with forums, watch our Welcome Guide to get started.
Excel & Word have the Screen Updating method thru which a developer can lock the main window from unnecessarily redrawing itself whilst the macro is being executed. If left alone, redrawing is not only ugly on the eyes it also takes more time for the macro to reach completion.
Hence I created this generic wrapper to lock the window updates.
What you can try is keep word invisible while you work on it. It is using the exact macro language (I can more-or-less cut and paste from a Word VBA backend), but yeah it's automation. Maybe it's sending individual macro commands (using automation) from my . However, there doesn't seem to anything that its particularly slow in your code.' 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.So this might seem counter-intuitive, but turn back on the visibility and screen updating and watch it go.Maybe if Word never actually got a chance to create it's main window, it emulates something and slows down.The macro involves adding a lot of text, then inserting tables, and inserting text into the tables. You could try minimising the application to make sure that screen updating is not involved.It's a five page document and takes a long time to complete, like 35 seconds. However 35 to 50 seconds does sound like a long time to create a five-page document, but it would depend on exactly what you are doing. It's already completely in the background, better than minimized I would think.You can 'hop' from cell to cell using the For Each construct on the Cells collection in a Row or in a Table. If you do use a template, you can keep formatted boilerplate text ready for use as Autotext, but of course that won't help much if your bottleneck is table cell filling. Although this might not speed up the actual run time (in fact, it could make it slower), it might give the program the appearance of being faster, especially if your program requires a lot of repainting and updating.Certainly, it gives control back to the user while you wait for the code to finish.I was trying to figure out a way to speed up the macro, I tried the Application. sf Query Term Info=1 macro suspend updat word and it actually slowed it down, to about 50 seconds. There might be ways to speed the macro up, but it's hard to guess without knowing what is in it. It would be hard to post (or rather, hard to understand), since I've wrapped my functionality into a "my Word Doc Builder" class that just abstracts my report building.Can anyone think of any other word macro things that could speed up the building of a document using the macro language? To my knowledge there is no way to group scripts into commands. I'm surprised that disabling screen updating slowed things down. Visible - True This will completely hide word while your program works. It is merely combinations of the following calls: wordapp. Type Textry) (to set up the next table insert, after messing around in the cells) My sequencing might not be optimal, but shouldn't be 35 seconds inefficient.