seafalcon
15 years agoContributor
Run time error when using ACD driver to access an Excel File (Office2007 installed )
Why Microsoft Jscript runtime error thrown?
The excel file is pretty standard..No clue...
/////////////////////////////////Code as below///////////////////////////////////////////////////////
var RecNo;
// Posts data to the log (helper routine)
function ProcessData()
{
var Fldr, i;
Fldr = Log["CreateFolder"]("Record: " + aqConvert.VarToStr(RecNo));
Log["PushLogFolder"](Fldr);
// if (! (DDT["CurrentDriver"]["Exists"]) )
// Log["Warning"]("MS Word is closed");
for(i = 0; i < DDT["CurrentDriver"]["ColumnCount"]; i++) //This line throw exception, but why>?
Log.Message("helloworld");
Log.Message(DDT["CurrentDriver"]["ColumnName"](i) + ": " + aqConvert.VarToStr(DDT["CurrentDriver"]["Value"](i)));
Log["PopLogFolder"]();
RecNo = RecNo + 1;
}
// Creates the driver (main routine)
function TestDriver()
{
var Driver;
// Creates the driver
// If you connect to an Excel 2007 sheet, use the following method call:
// Driver = DDT["ExcelDriver"]("C:\\MyFile.xls", "Sheet1", true);
Driver = DDT["ExcelDriver"]("C:\\MyFile.xls", "Sheet2");
// Iterates through records
RecNo = 0;
while (! Driver["EOF"]() )
{
ProcessData(); // Processes data
Driver["Next"](); // Goes to the next record
}
// Closing the driver
DDT["CloseDriver"](Driver["Name"]);
}
The excel file is pretty standard..No clue...
/////////////////////////////////Code as below///////////////////////////////////////////////////////
var RecNo;
// Posts data to the log (helper routine)
function ProcessData()
{
var Fldr, i;
Fldr = Log["CreateFolder"]("Record: " + aqConvert.VarToStr(RecNo));
Log["PushLogFolder"](Fldr);
// if (! (DDT["CurrentDriver"]["Exists"]) )
// Log["Warning"]("MS Word is closed");
for(i = 0; i < DDT["CurrentDriver"]["ColumnCount"]; i++) //This line throw exception, but why>?
Log.Message("helloworld");
Log.Message(DDT["CurrentDriver"]["ColumnName"](i) + ": " + aqConvert.VarToStr(DDT["CurrentDriver"]["Value"](i)));
Log["PopLogFolder"]();
RecNo = RecNo + 1;
}
// Creates the driver (main routine)
function TestDriver()
{
var Driver;
// Creates the driver
// If you connect to an Excel 2007 sheet, use the following method call:
// Driver = DDT["ExcelDriver"]("C:\\MyFile.xls", "Sheet1", true);
Driver = DDT["ExcelDriver"]("C:\\MyFile.xls", "Sheet2");
// Iterates through records
RecNo = 0;
while (! Driver["EOF"]() )
{
ProcessData(); // Processes data
Driver["Next"](); // Goes to the next record
}
// Closing the driver
DDT["CloseDriver"](Driver["Name"]);
}