Word Automation Speed Slow

D

DDJ

I took a look at this ng's FAQs and could only locate one article (by Daryl
Lucas) with some pointers regarding speeding up Word Automation from VB6.
These were fairly limited in scope...can anyone point me to some more
detailed discussions on how to speed up Word Automation? Seems like it's
really slow from the testing I've done so far (creating tables in code seems
to be the worst).

Dan
 
D

DDJ

Thanks for your response.

We are primarily taking data from a table used by our program and writing
the data to a report created using Word.

To give an example...one report requires the building of approx. 10, five
colum tables to output a two page report. Without having actually measured
the time it takes, I can say that it seems to take quite a long time, in the
range of 30 seconds or more. This, for a report that I wouldn't consider
terribly long.

I have been sticking with using Range objects; screen updating is switched
off; and Word is hidden (at least until the document has finished processing
and is opened in Preview mode).

One area in which I was hoping there would be a more efficient way to
proceed...the examples I'm using (from various help files, etc.), show each
Word table being populated cell by cell, from row to row (the "Z" pattern)
using "For Each" iterations. Is this really the fastest way to go? The
same goes for formatting these cells. I think I can probably learn ways to
format the larger pieces (say at the table level) that are faster than doing
so at a lower level (the cell level).

Any input appreciated.

Dan
 
J

Jay Freedman

A couple more tips:

- In general, build as much of the automation as possible in macros
within VBA, and call them from VB. The OLE interface between VB and
VBA is often the slowest part of the operation, so minimize the
message-passing between them.

- For tables specifically, the fastest method is usually to build up
the text of the table as ordinary text, with tabs between columns and
a paragraph mark at the end of each row. When it's all ready, use
ConvertTextToTable. Also see
http://www.word.mvps.org/FAQs/TblsFldsFms/FastTables.htm.
 
D

DDJ

Thanks all for the comments/suggestions.

I played with this today using some of the suggestions on the MVP site and
was able to reduce the time it takes to process tables significantly (very
significantly!).

Now I'm working trying to figure out how to reduce the resource consumption.
The CPU goes to 100% while the document is being written in code, then
(oddly) stays at 100% for a long time (60 to 120) seconds after that (I'm
using a table with five columns and 1000 rows for testing purposes). Any
thoughts here would be appreciated.

Dan
 
A

Alex_P

We have applications written in VB6 which are producing large 200 - 500 pages
word documents with a lot of content, such as : pictures, tables, styles,
etc. After installation of MS Word 2003 the performance decreased
tremendously, from 40 min to 4 hours per 200 pages. We also noticed that as
document gets bigger, then we begin to notice slowing down. We contacted
Microsoft, but haven't heard the from them
 
A

AlexP

We have application written in VB 6.0 which costructs large Word documents
200 -500 pages with a lot of content, such as: pictures, tables, styles, etc.
It was taking about 40 min to build 200 pages document. We had used this
application from Word 97 to Word 2002. Recently we had our stations upgraded
with Office 2003 and we have experienced tremendous performance degrade. It
took about 4 hours to do the same document. Is anybody aware what happens? We
have contacted Microsoft, but so far we have not received an answer.
 

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