RTE 5941 The requested member of the collection does not exist

G

Guy Cohen

Hi All
I use VB6 + Word97 late binding.

In my application I use docVariables to put a info in a word document.

The code that raise the error looks like this:
-
Set wField = WordDoc.Fields(WordDoc.Variables("tblTravels").Index)
-
wField is declared as object

When I looked in the watch window :

WordDoc.Variables("tblTravels").Index = 22

So I dont understand why it is not found in the collection.
 
J

Jonathan West

There are two collections being referenced in that line of code, the
Variables collection and the Fields collection. Does your document have at
least 22 fields in it? What is the value of WordDoc.Fields.Count at the time
you reach that line of code?
 
Top