Skip to main content

Activate-a-Worksheet

Command Description

Activate the specified sheet

Command Prototype

Excel.ActiveSheet(objExcelWorkBook,sheet)

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))
sheetTrueexpression"Sheet1"The string means sheet name. The number means sheet order(starting from 0)

Demo

/************************Activate worksheet************************ ********* 
**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).
**Entry 2:
** sheet--If a string is used, it means the name of the specified worksheet; if a number is used, it means the order of the specified worksheet (starting from 0).
**
*********************************************************************/

objExcelWorkBook = Excel.OpenExcel(@res"Test.xlsx",True,"Excel","","")
Excel.ActiveSheet(objExcelWorkBook,"Sheet1")
TracePrint "Activate Sheet: Excel object 'Sheet1' sheet already activated"
Excel.CloseExcel(objExcelWorkBook,False)