I do have few files name (resume.xlw) but none of them are open.
the only application that open at the time of run the test is testcomplete & SQL server
The script I am using, I found it online.
below is sample of script I used of course with my modification to fit my settings
Function Main()
{
var ConnectionString = “DRIVER = SQL Server; SERVER=H_kptest; UID=aaa; PWD=aaa”;
var TableName = “ListofOrders”;
var ExcelFilePath = “C:\Book1.xls”;
var SheetName = “sheet1”;
ExportTbaleToExcelFile(ConnectionString, TableName, ExcelFilePath, SheetName);
}
Function ExportTbaleToExcelFile (ConnectionString, TableName, ExcelFilePath, SheetName)
{
//Creates a new connection
var connDB = ADO.CreateConnection();
connDB.ConnectionString = connectionString;
connDb.Open();
//opens a record set
var Tbl = connDB.Execute(“SELECT * FROM” + TableName);
//opens an Excel file
var MsExcel = Sys.OleObject(“Excel.Application”);
MsExcel.Workbooks.Open(ExcelFilePath);
var Sheet = MsExcel.Sheets(SheetName);
MsExcel.Visible = true;
//copies field Names
for (var i=0; i< Tbl.Fields.Count; i++)
Sheet.Cells(1, i+1).value = Tble.Fields.Item(i).Name;
//scans all records returned by the query
Tbl.MoveFirst();
var RowIndex =2;
while (! Tbl.EOF)
{
For (i=0; i < Tbl.Fields.Count; i++)
Sheet.Cells(RowIndex, i + 1).Value = Tbl.Fields.Item(i).Value;
Tbl.MoveNext();
RowIndex++;
}
//closes the Excel File
MsExcel.Save();
MsExcel.Workbooks.Close();
//Closes the recordset and the connection
Tbl.Close();
connDB.Close();
}