I've written a Word VBA procedure that pulls data from multiple Excel documents into a report. It does this by calling several Excel VBA procedures.
One of those Excel documents contains three columns. I re-use this document a lot and the number of rows is different each time; it can be as few as 2 and has so far gone as high as 30. Row 1 in each column contains a header, such as NAME, INFO, and DATE. Column A is filled with a constant, such as "Bob." Column B contains different text in each row. Column C contains a different date in each row, written out in "January 10, 2012" format.
Word opens this Excel document and calls an Excel procedure named Report. Report counts the number of rows containing data and passes this number back to Word. I also want it to pass every date in column C back to Word. I'm trying to use an array named Dates for this purpose.
Within the Word procedure, I have:
In the Excel procedure named Report, I have:
When I run this, it stops at the line "Dates(CountB) = Cells(CountB, 3).Value" and tells me "An array index is out of range." Any idea on how I can work with this? I'm using Office 2007.
Thanks!
Bookmarks