Run time error when using ACD driver to access an Excel File (Office2007 installed )
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2010
02:44 PM
07-21-2010
02:44 PM
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"]);
}
Find the faith in life
3 REPLIES 3
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2010
03:55 PM
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2010
04:46 PM
07-21-2010
04:46 PM
One more thing, if the Ts like this, it's executable without exception
for(i = 0; i < DDT["CurrentDriver"]["ColumnCount"]; i++)
Log.Message(DDT["CurrentDriver"]["ColumnName"](i) + ": " + aqConvert.VarToStr(DDT["CurrentDriver"]["Value"](i)));
However, if I input an extra line between, it will throw exception.. why? I am not a VBscript master.. In java, this shouldn't throw any exception.. I am beat!
for(i = 0; i < DDT["CurrentDriver"]["ColumnCount"]; i++)
Log.Message(DDT["CurrentDriver"]["ColumnName"](i) + ": " + aqConvert.VarToStr(DDT["CurrentDriver"]["Value"](i)));
Find the faith in life
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2010
07:29 PM
07-21-2010
07:29 PM
Hi Philip,
Your code works without exceptions for me. Could you please send us the entire project suite folder containing script units with both the problematic code and the code of creation of a DDT driver? Please contact us directly via the Contact Support form.
--
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Dmitry Nikolaev
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
