Array issue

Hi All,

I am trying to pull the value from miltiple documents in the view. Then I am creating a Word document and passing these values to the field in Word. How can I pass multiple values (arrays) to a MS Word.

Example: Values thatI am trying to pass are (3), (4), (5), (6).

Here is a part of my code:

Redim VendorCodeArray(1 To collection.count) As Variant

For j = 1 To collection.Count

VendorCodeArray(j) = collection.GetNthDocument(j).Vendor(0)

Next

Call tableobj.cell(j,9).select

temp = VendorCodeArray(j)

Call wordobj.selection.typetext(temp)

I am getting “Subscript out of range” error.

When I debug this code, VendorCodeArray(j) = (3) and (4).

Thank you,

-vadim

Subject: Array issue

Next always increments the counter, so j is (collection.Count + 1) after the loop.