Thanks, Robert!
The extension is really pretty simple:
function excel(state, path, worksheet)
{
if(state=='open')
{
var Excel;
Excel = Sys.OleObject("Excel.Application") ;
Excel.Workbooks.Open(path).Worksheets(worksheet).Activate;
}
if(state=='close')
{
Excel.displayalerts = false;
Excel.SaveWorkspace();
Excel.displayalerts = true ;
Excel.quit();
}
}
And in the script, you would do like so:
global.excel('open', 'F:/Spreadsheets/mySpreadsheet.xlsx', 'Worksheet_5') ;
Excel.Cells(10,15).Interior.ColorIndex = 0 ; // Set Cell background color to WHITE
global.excel('close') ;
Test Complete generates an exception when setting the background color of the cell in the spreadsheet: 'Excel' is undefined
So, at this point, I figured it was a scope issue.