Close Workbook Action

Declaration

<AMEXCELCLOSEWORKBOOK SESSIONNAME="text" SAVE="yes/no">

See Also

Create Workbook, Open Workbook,  Add Worksheet, Activate Worksheet, Get Cell, Set Cell, Cells to Dataset, Dataset to Cells

Description

Closes Microsoft Excel workbook previously opened in an established Excel session. If modifications have been made, the document will be saved.

Practical Usage

To close and save a Microsoft Excel document that was modified with prior AutoMate Excel steps. If this action is not used, the document will not be saved.

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 "Default"
MARKUP: SESSION="YES"

Specifies the session name to identify which document should be closed from prior Excel steps. This allows several Excel files to be open simultaneously. If working with only one document, this value should not be changed from it's default value.

Do not save changes

Yes/No, Optional - Default YES
MARKUP:
a) SAVE="no"

When enabled, specifies that the document should be closed but not saved. The default behavior is to save the document when it is closed.

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.

<AMEXCELCREATEWORKBOOK WORKBOOK="c:\myexceldocument.xls">

     <AMEXCELSETCELL NEWVALUE="Set this data here" CELLROW="1" CELLCOLUMN="1">

     <AMEXCELSETCELL NEWVALUE="and this here" CELLROW="2" CELLCOLUMN="1">

<AMEXCELCLOSEWORKBOOK>