Get Active Cell

Declaration

<AMEXCELGETACTIVECELL SESSION="Text"  ACTION="Text" CELLREFVARIABLE="Text" CELLROWVARIABLE="Text" CELLCOLUMNVARIABLE="Text"  UPPERLEFTREFVARIABLE="Text" LOWERRIGHTREFVARIABLE="Text"  UPPERLEFTROWVARIABLE="Text" UPPERLEFTCOLUMNVARIABLE="Text" LOWERRIGHTROWVARIABLE="Text" LOWERRIGHTCOLUMNVARIABLE="Text" />

See Also

Get Active Cell Action-Setting Properties Create Workbook, Open Workbook, Close Workbook, Add Worksheet, Activate Worksheet,  Set Cell, Cells to Dataset, Dataset to Cells

Description

Retrieves the position of the currently active cell or cells in an established Excel session. The action populates one or more variables with the cell reference or position coordinates.

Practical Usage

Used to find the currently active cell or cells in a Microsoft Excel document that was previously created or opened using one of AutoMate's Excel actions. This action is only useful in conjunction with the other Excel actions found in AutoMate.

IMPORTANT: The Excel actions in AutoMate use the Microsoft Excel automation engine to perform their work. Because of this, Microsoft Excel must be licensed and installed on the system to use the Excel actions.

Parameters

General Tab

Session Name

Text, Optional - Default "ExcelSess1"
MARKUP: SESSION="ExcelSess2"

Specifies the session name to identify which document should be acted on. This allows several Excel files to be open simultaneously. If working with only one document, this value should not be changed from its default value.

Get Active

Text [options], Optional - default "cell by reference"
MARKUP: ACTION="rangebyposition"

Specifies the cell designation method.

Options are:
 

Populate Variable With Cell Reference

Text, Required if active
MARKUP: CELLREFVARIABLE="VariableName"

Specifies the variable to populate with the cell reference. Active only if Cell by reference [Default] is the selected Activate [ACTION] parameter.  

Populate Variable With Row

Text, Required if active
MARKUP: CELLROWVARIABLE="VariableName"

Specifies the variable to populate with the cell row. Active only if Cell by position [CELLBYPOSITION] is the selected Activate [ACTION] parameter.

Populate Variable With Column

Text, Required if active
MARKUP: CELLCOLUMNVARIABLE="VariableName"

Specifies the variable to populate with the cell column. Active only if Cell by position [CELLBYPOSITION] is the selected Activate [ACTION] parameter.  

Populate Variable With Upper Left Cell

Text, Required if active
MARKUP: UPPERLEFTREFVARIABLE="VariableName"

Specifies the variable to populate with the reference for the upper left cell in the range of active cells. Active only if Range of cells by reference [rangebyreference] is the selected Activate [ACTION] parameter.

Populate Variable With Lower Right Cell

Text, Required if active
MARKUP: LOWERRIGHTREFVARIABLE="VariableName"

Specifies the variable to populate with the reference for the lower right cell in the range of active cells. Active only if Range of cells by reference [rangebyreference] is the selected Activate [ACTION] parameter.

Populate Variable With Upper Left Cell Row

Text, Required if active
MARKUP: UPPERLEFTROWVARIABLE="VariableName"

Specifies the variable to populate with the row number of the upper left cell in the range of active cells. Active only if Range of cells by position [rangebyPOSITION] is the selected Activate [ACTION] parameter.

Populate Variable With Upper Left Cell Column

Text, Required if active
MARKUP: UPPERLEFTCOLUMNVARIABLE="VariableName"

Specifies the variable to populate with the column number of the upper left cell in the range of active cells. Active only if Range of cells by position [rangebyPOSITION] is the selected Activate [ACTION] parameter.

Populate Variable With Lower Right Cell Row

Text, Required if active
MARKUP: LOWERRIGHTROWVARIABLE="VariableName"

Specifies the variable to populate with the row number of the lower right cell in the range of active cells. Active only if Range of cells by position [rangebyPOSITION] is the selected Activate [ACTION] parameter.

Populate Variable With Lower Right Cell Column

Text, Required if active
MARKUP: LOWERRIGHTCOLUMNVARIABLE="VariableName"

Specifies the variable to populate with the column number of the lower right cell in the range of active cells. Active only if Range of cells by position [rangebyPOSITION] is the selected Activate [ACTION] parameter.

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMEXCELGETACTIVECELL SESSION="ExcelSess1" ACTION="rangebyposition" UPPERLEFTROWVARIABLE="VariableName1" UPPERLEFTCOLUMNVARIABLE="VariableName2" LOWERRIGHTROWVARIABLE="VariableName3" LOWERRIGHTCOLUMNVARIABLE="VariableName4" />