Expanding Tables in Word Templates

B

Bips

We are using word 2003/ 2007 for creating templates with formfields. Some of
the templates have expanding tables. We use visual basic 6.0 to invoke word
and pass the formfields values from our application to populate these
formfields at runtime/ batch. The problem we are facing is that after several
runs the tables get corrupted and we get all sorts of weird errors as if the
object itself does not exist. We debugged through our Vb code and it seems
like it is failing when it is trying to save a local copy of the formfield
object. Below is the code, it fails in the set statement for the 10th
formfield in random documents.

llong_fields = guobj_doc.FormFields.Count
ReDim luobj_formfields(llong_fields) As FormField

' Loop thru all form fields in the document
For llong_field = 1 To llong_fields
Set luobj_formfields(llong_field) = guobj_doc.FormFields(llong_field)
If gbool_debug Then fpvt_debug "fpub_compose_corr:Looping through
the form fields " & Str(llong_field) & " Name:" &
CStr(guobj_doc.FormFields(llong_field).Name), True
Next
 

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