Forum Discussion

mikev's avatar
mikev
Contributor
14 years ago

Single Driver, Multiple Sheets Open?

How can I get around this, short of having several excel files.  I'll try to explain:





//Set up the test directory and point to the Excel file that contains our data.

var testDir = Project.Path;

var testData = testDir + "\\MyExcelFile.xls;



//Set up the first driver, to the first sheet in our excel file

var myFirstSheet = DDT.ExcelDriver(testData, "sheet1");



//Get the first value (1st row, 1st column) in our first sheet.  I want to use this value to open another sheet.

var sheetValue = myFirstSheet.Value("myFirstField");



//Based on the sheetValue, open up another driver

var mySecondSheet= DDT.ExcelDriver(testData, sheetValue);





I *think* all of this is working OK, until I get to this point:





while (!myFirstSheet.EOF()) {
//For each row in first sheet, we need to run several rows in secondSheet
while (!mySecondSheet.EOF) {
.........
.........
mySecondSheet.Next();
}
myFirstSheet.Next();





The error that I'm getting is:



An exception occurred in the "AddCollections" unit at line 30:

Microsoft JScript runtime error

Object doesn't support this property or method



This is the line with the error:



while (!mySecondSheet.EOF)

2 Replies

  • Nevermind, I'm an idiot:





    while (!collectSheet.EOF()) {




  • sastowe's avatar
    sastowe
    Super Contributor
    Mike, I find that IMMEDIATELY after posting to a forum is when I figure the thing out for myself. And figuring it out usually means I was an idiot in the first place. You are not alone. :)