Get Active Worksheet Action

Retrieves the name or index of the currently active worksheet in an established Excel session. The action populates either or both of two variables, one for the worksheet name and the other for the index. Used to find the currently active worksheet in a Microsoft Excel document that was previously created using the Create Workbook action or opened using the Open Workbook action. Other Excel actions such as Get Active Cell can be used in subsequent steps.

Declaration

<AMEXCELGETACTIVEWORKSHEET SESSION="text" WORKSHEETNAMEVARIABLE="text" WORKSHEETINDEXVARIABLE="text" />

Get active worksheet in workbook open in session "mySession". Populate variable "theName" with the worksheet name. Populate variable "theIndex" with the worksheet index.

<AMEXCELGETACTIVEWORKSHEET SESSION="mySession" WORKSHEETNAMEVARIABLE="theName" WORKSHEETINDEXVARIABLE="theIndex" />

See Also: Create Workbook, Open Workbook, Close Workbook, Add Worksheet, Activate Worksheet, Set Cell, Cells to Dataset, Dataset to Cells

AWE's Excel actions use Microsoft's Excel automation engine to perform their work. Therefore, Microsoft Excel must be licensed and installed on the system in order for these actions to work. Excel objects run in the context of the user executing them. If EFT is running as a Local System, then the Excel object is executed using the Local System profile. Before using an Excel action in Event Rules, refer to Globalscape Knowledgebase article #11089 for important information.

This action is only useful in conjunction with other Excel actions. It is not possible to use AWE's Excel actions on a spreadsheet that was not opened by the Open Workbook action or created by the Create Workbook action.

General Tab

Property

Type

Required

Default

Markup

Description

Session Name

Text

Yes

ExcelSess1

SESSION="ExcelSess7"

The name of the session to associate with this Excel action. Numerous sessions can exist within a single task allowing several spreadsheets to be open simultaneously. If working with only one document, this can remain at the default session name, which is Excelsess1.

Populate Variable with Worksheet Name

Text

Yes if Index variable is ignored

(Empty)

WORKSHEETNAMEVARIABLE=

"theName"

The name of the variable to be populated with the worksheet name.

Populate Variable With Worksheet Index

Text

Yes if Name variable is ignored

(Empty)

WORKSHEETINDEXVARIABLE=

"theIndex"

The name of the variable to be populated with the worksheet index. An index number is a sequential number assigned to a sheet, based on the position of its sheet tab (counting from the left) among sheets of the same type.