I'm generating a document in VBA that reads data from a database and then creates a document. I have 5-6 levels of nested tables necessary to format the data. The resultant document is about 100 pages. The generation of the document and formatting of the tables takes 9+ hours to complete on a P4/512MB. Needless to say this will not be acceptable. When I single step thru some of the formatting commands (like setting up borders and bolding text) I can see it takes several seconds for each command. What can I do to improve speed?

Re: tables in tables very slow by Jezebel

Jezebel
Tue Aug 03 18:12:03 CDT 2004

Some suggestions --

1. Work entirely with Range objects (never the Selection object).
2. Instead of applying formatting (like applying borders and bolding text),
predefine styles in the template you're using, then apply those.
3. Work with the document hidden (so Word doesn't need to repaginate it
repeatedly).
4. Use With ... End With constructions to set multiple properties of the
same object, rather than setting them individually.



"tomk20" <tomk20@discussions.microsoft.com> wrote in message
news:FE95308D-1FCE-4815-957E-49F8E66E6852@microsoft.com...
> I'm generating a document in VBA that reads data from a database and then
creates a document. I have 5-6 levels of nested tables necessary to format
the data. The resultant document is about 100 pages. The generation of the
document and formatting of the tables takes 9+ hours to complete on a
P4/512MB. Needless to say this will not be acceptable. When I single step
thru some of the formatting commands (like setting up borders and bolding
text) I can see it takes several seconds for each command. What can I do to
improve speed?



Re: tables in tables very slow by Klaus

Klaus
Tue Aug 03 18:29:57 CDT 2004

Hi Tom,

Most importantly: Keep the tables short.
If some of your tables should span several pages, that'll kill Word.

"5-6 levels of nested tables" sounds rather weird... Never have seen
anything like it.
Is this really necessary? I've never seen any need for nested tables,
though some of the tables I do are very complex.

Regards,
Klaus




tomk20 wrote:
> I'm generating a document in VBA that reads
> data from a database and then creates a document.
> I have 5-6 levels of nested tables necessary to format
> the data. The resultant document is about 100 pages.
> The generation of the document and formatting of the
> tables takes 9+ hours to complete on a P4/512MB.
> Needless to say this will not be acceptable.
> When I single step thru some of the formatting commands
> (like setting up borders and bolding text) I can see it takes
> several seconds for each command.
> What can I do to improve speed?



tables in tables very slow by DA

DA
Tue Aug 03 22:08:16 CDT 2004

In addition to the comments from Jezebel, I'd also make
sure you're clearing your Undo buffer on a regular basis
(e.g. ActiveDocument.UndoClear).

I agree with Klaus that nesting tables to 5 or 6 levels
seems overkill. I feel that any code optimization methods
will still not yield you the performance you're after.
It's a great product, but unfortunately we all know you
can only stretch Word so much before the seams start
bursting..

Best of luck,
Dennis.

>-----Original Message-----
>I'm generating a document in VBA that reads data from a
database and then creates a document. I have 5-6 levels
of nested tables necessary to format the data. The
resultant document is about 100 pages. The generation of
the document and formatting of the tables takes 9+ hours
to complete on a P4/512MB. Needless to say this will not
be acceptable. When I single step thru some of the
formatting commands (like setting up borders and bolding
text) I can see it takes several seconds for each
command. What can I do to improve speed?
>.
>