Excel - Select Cell(s)

Declaration

<AMEXCEL ACTIVITY="activate_cell" CONNECTBY="text (options)" 
WORKBOOK="text" INVISIBLE="YESNO" WORKBOOKTEMPLATE="text" 
OVERWRITE="YES/NO" SAVETYPE="text (options)" 
DESTINATION="text" OVERWRITEDESTINATION="YES/NO" 
ACTION="rangebyreference" UPPERLEFTREF="text" 
LOWERRIGHTREF="text" />

Description: Selects a cell or range of cells within the currently active worksheet.

IMPORTANT: Excel activities rely on Microsoft's Excel engine to perform their work,therefore, MS Excel must be licensed and installed on the system in order for these activities to function properly.

Practical Usage

Used to activate a cell or range of cells in the active worksheet of a Microsoft Excel document. Ideal for selecting one or more cells in order to perform an activity, such as formatting the cells or entering values in them. Be aware that this activity works only on the active worksheet. To activate a specific worksheet, use the Activate worksheet activity.

Resource Parameters

Property

Type

Required

Default

Markup

Description

Resource

 

 

 

 

Indicates where the source Excel document should originate from. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:

  • File (default) - The source derives from an Excel file located on the system. This option is normally selected if only a single activity is required to complete the operation.

  • Session - The source Excel document is obtained from a pre-configured session created in an earlier step with the use of the Open/Create workbook activity. This option is normally selected if a combination of related activities are required to complete an operation. Consolidating several activities to a single session can eliminate redundancy. Moreover, a single task supports multi-session executions which can improve efficiency and speed up production.

Session

Text

Yes if Resource is set to Session

Excelsession1

SESSION="mySession"

The name of an existing session to associate this activity with. This parameter is active only if the Resource parameter is set to Session.

Get document by

Text (options)

Yes if Resource is set to File

Open

  1. CONNECTBY="open_workbook"

  2. CONNECTBY="create_workbook"

Specifies whether this activity will be performed on an existing Excel document or on a new one. This parameter is active only if the Resource parameter is set to File. The available options are:

  • Open (default) - This activity will be performed on an existing document that will be opened during runtime.

  • Create - This activity will be performed on a new document to be created during runtime.

File name

Text

Yes

(Empty)

WORKBOOK="C:\Temp\file.xls"

If the Get document by parameter is set to Open, specifies the path and filename of the Excel document in which to open. If the Get document by parameter is set to Create, specifies the path and filename of the Excel document in which to create.

Application is invisible

Yes/No

No

No

VISIBLE="NO"

If set to YES, specifies that the Excel window will not be displayed and all processing will occur in the background. This option should be set to NO during task construction and debugging but can be set to YES for production. The workbook is visible by default.

Password to open (optional)

Text

No

(Empty)

OPENPASSWORD="encrypted"

The password required to open the Excel document if it is password protected. This parameter is active only if the Get document by parameter is set to Open.

Password to modify (optional)

Text

No

(Empty)

MODIFYPASSWORD="encrypted"

The password required to modify the Excel document if it is password protected. This parameter is active only if the Get document by parameter is set to Open.

Create from template

Text

No

No

WORKBOOKTEMPLATE="C:\Temp\file.xls"

If enabled, specifies the path and filename of a template file that already has preferred formatting in which to base the new workbook on. A template can include formatting, styles,  standardized text such as page headers and row and column labels, formulas, macros and custom toolbars. This parameter is active only if the Get document by parameter is set to Create. It is disabled by default.

Overwrite if workbook already exists

Yes/No

No

No

OVERWRITE="yes"

If set to YES, the newly created workbook will overwrite an existing workbook with the same name, If set to NO, an error will occur during runtime as a result of a matching filename. This parameter is active only if the Get document by parameter is set to Create.

On completion

Text (options)

No

Save

  1. SAVETYPE="save"

  2. SAVETYPE="save_as"

  3. SAVETYPE="do_not_save"

Specifies what to do with the document upon completion of this activity. The available options are:

  • Save - Save changes to the current location.

  • Save as - Save to the specified path and filename.

  • Do not save changes - Changes will not be saved.

Overwrite if workbook already exists

Yes/No

No

No

OVERWRITEDESTINATION="YES"

If set to YES, specifies that existing Excel files with matching names that exist in the destination will be overwritten. If set to NO, matching files will not be overwritten, however, a runtime error will occur as a result. Set to NO by default.

Cell Parameters

Property

Type

Required

Default

Markup

Description

Get

Text (optionss)

Yes

Cell by reference

  1. ACTION="rangebyreference"

  2. ACTION=& quot;cellbyposition"

  3. ACTION="rangebyreference"

  4. ACTION="rangebyposition"

Specifies the cell selection method. The available options are:

  • Cell by reference(default) - Gets a single cell specified by its cell reference, such as A1 or B3.

  • Cell by position - Gets a single cell specified by its row and column position, such as Row 2, Column F.

  • Range by reference - Gets a range of cells specified by the cell reference for the upper left and lower right cells in the range, such as Upper left cell = A1, Lower right cell = C3.

  • Range by position - Gets a range of cells specified by the row and column positions of the upper left and lower right cells in the range (e.g., Upper left cell row = 1, Upper left cell column = 1, Lower right cell row = 14, Lower right cell column = 3).

Cell reference

Text

Yes if activate method is Cell by Reference

(Empty)

CELLREF="B3"

The reference of the cell to activate. Active only if Cell by reference is the selected Activate parameter.

Row

Number

Yes if activate method is Cell by position

1

CELLROW="3"

The row of the cell to activate. Active only if Cell by position is the selected Activate parameter.  

Column

Number

Yes if activate method is Cell by position

1

CELLCOLUMN="2"

The row of the cell to activate. Active only if Cell by position is the selected Activate parameter.  

Upper Left Cell

Text

Yes if activate method is Cell by reference

(Empty)

UPPERLEFTREF="A1"

The reference of the upper left cell in the range of cells to activate. Active only if Range by reference is the selected Activate parameter.

Lower Right Cell

Text

Yes if activate method is Cell by reference

(Empty)

LOWERRIGHTREF="C5"

Specifies the reference of the lower right cell in the range of cells to activate. Active only if Range of cells by reference is the selected Activate parameter.

Upper Left Cell Row

Number

Yes if activate method is Cell by position

(Empty)

UPPERLEFTROW="1"

Specifies the row of the upper left cell in the range of cells to activate. Active only if Range of cells by position is the selected Activate parameter.

Upper Left Cell Column

Number

Yes if activate method is Cell by position

(Empty)

UPPERLEFTCOLUMN="1"

Specifies the column of the upper left cell in the range of cells to activate. Active only if Range of cells by position is the selected Activate parameter.

Lower Right Cell Row

Number

Yes if activate method is Cell by position

(Empty)

LOWERRIGHTROW="14"

The row of the lower right cell in the range of cells to activate. Active only if Range of cells by position is the selected Activate parameter.

Lower Right Cell Column

Number

Yes if activate  method is Cell by position

(Empty)

LOWERRIGHTCOLUMN="3"

The column of the lower right cell in the range of cells to activate. Active only if Range of cells by position is the selected Activate parameter.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example 1 - Activate a single cell by position.

<AMEXCELACTIVATECELL SESSION="ExcelSess10" 
ACTION="cellbyposition" CELLROW="2" CELLCOLUMN="3" />

Example 2 - Activate a range of cells by position.

<AMEXCELACTIVATECELL SESSION="ExcelSess10" 
ACTION="rangebyposition" UPPERLEFTROW="2" 
UPPERLEFTCOLUMN="3" LOWERRIGHTROW="5" LOWERRIGHTCOLUMN="5" />