Question

Locked

FIlling out word document from VB6, but its really slow!

By Slayer_ ·
So I am tasked with filling out a legal document with data from our database. Roughly 650 fields. The word document is a protected document with form fields.

I figure I can fill it this way with a series of these commands.

oDocument.FormFields.Item(i).Result = "Field Data Goes Here"

However, this is painfully slow, about 5 fields a second. Is there any way I can speed this up, or a different way to fill them out?

This conversation is currently closed to new comments.

16 total posts (Page 2 of 2)   Prev   01 | 02
Thread display: Collapse - | Expand +

All Answers

Collapse -

I don't think this is quite it

by Slayer_ In reply to For your Excel try here, ...

Though I just had an idea, what if I tried to take the return value of the Sheet.Cell() call and assigned it to a blank combobox control, changed its value, and assign it back, maybe that would work.

Collapse -

Figured it out!

by Slayer_ In reply to FIlling out word document ...

Word is a POS.

I wrote this to cover it, makes it almost instant.


On Error Resume Next
oDocument.FormFields.Item(iIndex).Range.Fields(1).Result.Text = sText
If Err.Number <> 0 Then
Err.Clear
On Error GoTo 0
oDocument.FormFields.Item(iIndex).Result = sText
End If


The first longer one is a version that runs instant and has no length restrictions, but it randomly errors on some fields, so for those fields, I have it revert to the old way which was slower and has 256 character limit, but works.

Go figure, more object calls fixed the problem.

Collapse -

Glad u got it figured out...

by mafergus In reply to Figured it out!

Yes word is a major POS. It's too bad you couldn't use a repoting package like crystal or active reports to generate it on the fly.

Collapse -

It would have been nice but

by Slayer_ In reply to Glad u got it figured out ...

This document has a high chance of changing, and we needed ability for user to change and add data as needed. This process just prefills known fields into the document to save the user some work.

Collapse -

ok...

by mafergus In reply to It would have been nice b ...

does that changed data get back into the database?

Collapse -

In this case, no

by Slayer_ In reply to ok...

I have a different one using Excel that does pull information back in, but this particular document for CUDGC does not.

Back to Software Forum
16 total posts (Page 2 of 2)   Prev   01 | 02

Related Discussions

Related Forums