Skip to main content

Activate-Excel-Window

Command Description

Activate the specified Excel Window

Command Prototype

Excel.ActiveBook(objExcelWorkBook)

Parameter Description

ParameterRequiredTypeDefaultDescription
objExcelWorkBookTrueexpressionobjExcelWorkBookExcel workbook object (workbook opened with "Open Excel" command (Excel.OpenExcel) or the workbook object returned by the command "Bind Excel" (Excel.BindBook))

Demo

/********************Activate the Excel workbook window********************** 
**Input 1:
** objExcelWorkBook--Excel workbook object (a workbook opened using the "Open Excel" command (Excel.OpenExcel) or a job bound using the "Bind Excel" command (Excel.BindBook) book object).
**
*********************************************************************/
// This command is used to activate the fixed object and put the fixed object file window on top when there are multiple Excel objects currently
objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",True,"Excel","","")
objExcelWorkBook2 = Excel.OpenExcel(@res"blank file.xlsx",True,"Excel","","")
Excel.ActiveBook(objExcelWorkBook)
TracePrint "Activate Excel Workbook Window: Excel object 'objExcelWorkBook' has been activated and brought the window to the top"
Excel.CloseExcel(objExcelWorkBook,False)
Excel.CloseExcel(objExcelWorkBook2,False)