Excel Modules
The folder TBox XEngines->Excel in the Standard subset contains Modules that perform specific tasks for the Excel Engine 3.0.
TBox Open Excel Workbook
The Module TBox Open Excel Workbook allows you to open an Excel file, i.e. an Excel workbook. Every workbook can contain several worksheets.
This step is mandatory for every Excel Engine 3.0 TestCase.
The Excel Engine 3.0 opens the file in the background. You do not actually see the file opening in Excel.
The Module TBox Open Excel Workbook has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Specify a name for the workbook. This can be any name. The Excel Engine 3.0 uses it to identify the file you want to steer in other Excel Engine 3.0 TestSteps. |
|
Path |
Full path to the Excel file that you want to open, including the file name and extension. |
Create new |
Specify whether you want to create a new Excel file.
You can create a new file with one of the file extensions supported by the Excel Engine 3.0, but you cannot create a new .xlsb file. |
In this example, you open the Excel file sales_data.xlsx, located at C:\Temp. You assign the name MyWorkbook to the workbook that you want to steer.
Open an Excel file |
In this example, you create the new Excel file marketing.xlsx. The Excel Engine 3.0 saves it to C:\Users\janedoe\Desktop. You assign the name CustomerData to the workbook that you want to steer.
Create a new Excel file and open it |
TBox Define Excel Range
The Module TBox Define Excel Range allows you to define a data range that you want to steer. This step is mandatory for every TestCase in which you want to manipulate a particular data range.
The Module has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Workbook Name |
Name of the workbook that you defined. |
Worksheet Name |
Name of the Excel worksheet that contains the data. This name must be an exact match for the worksheet within the workbook. |
Specify a name for the data range that you want to steer. This can be any name. The Excel Engine 3.0 uses it to identify the data range you want to steer in other Excel Engine 3.0 TestSteps. |
|
Data Range |
Read-only. |
Data Range->Start Cell |
Start cell of the data range that you want to steer. |
Data Range->End Cell |
End cell of the data range that you want to steer. |
In this example, you define a data range in the workbook MyWorkbook. This data range is located in the Excel sheet January. You assign the name JanuarySales to the data range. The range starts with cell A2 and ends with cell T982.
Define the range that you want to steer |
TBox Create Excel Worksheet
The Module TBox Create Excel Worksheet allows you to create a new worksheet in an existing Excel file.
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Workbook Name |
Name of the workbook that you defined. |
Worksheet Name |
Specify a name for the worksheet. |
Worksheet Order |
Define where the Excel Engine 3.0 should add the worksheet. You can enter the following values:
|
In this example, you create a new worksheet named JAN_summary in the workbook MyWorkbook. The Excel Engine 3.0 creates the worksheet as the second sheet in the Excel file.
Create a new worksheet |
TBox Excel Range Manipulation
The Module TBox Excel Range Manipulation allows you to manipulate data in an Excel file.
It has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Range Name |
Name of the data range that you defined. |
Data Table and its sub-Attributes |
Table element. Steer the data in your Excel file as you would steer a table. For information on how to do so, see chapter "Table". |
In this example, you steer the data range ExampleRange. The Excel Engine 3.0 looks for a row that fulfills the following requirements:
Then the Engine performs a verification. In this particular row, the value of the cell in the column Salary should be greater than 3000.
Steer Excel data |
TBox Run Excel Macro
The Module TBox Run Excel Macro allows you to run existing Microsoft Excel macros on an Excel file. For information on Microsoft Excel macros, see the Microsoft Excel documentation.
The Module has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Workbook Name |
Name of the workbook that you defined. |
Macro Name |
Name of the Microsoft Excel macro that you want to run. |
In this example, you run a macro called HighlightOverdueAccounts on the workbook Accounts.
Run a macro on the workbook Accounts |
TBox Close Excel Workbook
The Module TBox Close Excel Workbook allows you to close an open workbook. This step is mandatory for every Excel Engine 3.0 TestCase.
The Module has the following ModuleAttributes:
ModuleAttribute |
Description |
---|---|
Workbook Name |
Name of the workbook that you defined. |
Path |
Full path to the Excel file that you want to close, including the file name and extension. |
Save |
Specify whether you want to save the Excel file.
|
In this example, you close the Excel file sales_data.xlsx, located at C:\Temp. The Excel Engine 3.0 saves any changes.
Save and close an Excel file |