OpenDocument Spreadsheet - Close Workbook
Declaration
<AMODS ACTIVITY="close_workbook" SESSION="text" SAVETYPE="text (options)" DESTINATION="text" OVERWRITEDESTINATION="YES/NO" />
Description: Closes a workbook previously opened or created by the Open/Create workbook activity and ends the associated session.
Practical Usage
Mainly used to save and close a spreadsheet document that was modified with prior ODS steps and ends the associated session.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Session Name |
Text |
Yes |
ExcelSess1 |
SESSION="ExcelSess7" |
The session name to identify which document should be closed from prior Excel steps. Numerous sessions can exist within a single task allowing several Excel documents to be open simultaneously. |
On completion |
Text (options) |
No |
Save |
|
Specifies what to do with the document upon completion of this activity. The available options are:
|
File |
Text |
Yes if On completion parameter is set to Save as |
(Empty) |
DESTINATION="c:\temp\dest.xls" |
The path and filename of the file in which changes will be saved. Click the folder icon to open a standard Explorer dialog to navigate to the desired file or simply enter the path and filename in the provided text box. |
Overwrite if workbook already exists |
Yes/No |
Yes if On completion parameter is set to Save as |
No |
OVERWRITE="YES" |
If set to YES, the newly created workbook will overwrite any workbook with the same name that exists in the destination. If set to NO (default), an existing workbook with the same name will not be overwritten, however, an error will occur during runtime as a result of matching filenames. This parameter is active only if the Get document by parameter is set to Create. |
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
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description: This sample task opens a workbook, populates a dataset with data regarding the spreadsheets that it contains. The dataset is then looped. During each iteration, information about the current spreadsheet is displayed in a message dialog. The last step closes the workbook, thus ending the session.
<AMODS SESSION="OPENDOCSession1" WORKBOOK="C:\temp\Employees.xls" /> <AMODS ACTIVITY="list_worksheet" SESSION="OPENDOCSession1" RESULTDATASET="theSheets" /> <AMLOOP ACTIVITY="dataset" DATASET="theSheets"> <AMSHOWDIALOG WINDOWTITLE="Worksheet Information"> Worksheet Name: %theSheets.WorksheetName% Worksheet Index: %theSheets.WorksheetIndex% Is worksheet visible?: %theSheets.IsVisible% Is worksheet active?: %theSheets.IsActive%</AMSHOWDIALOG> </AMLOOP> <AMODS ACTIVITY="close_workbook" SESSION="OPENDOCSession1" />