Blue Prism - VBO Excel PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

MS Excel VBO Page 1 of 26

Business Object Definition


The information contained in this document is the proprietary information of Blue Prism
Limited and should not be disclosed to a third party without the written consent of an
authorised Blue Prism representative.
(c) Blue Prism Limited

About this document...


The Business Object Definition describes the APIs available within a single business object,
their parameters and their behaviours from both a business and technical perspective. The
definition of each object function describes the business function of the interface, the
parameters and usage of the business function and any technical notes required in the on-
going support of the interface, including reference to the capabilities of the object. The
Business Object Definition API is a dual-purpose document designed to serve the needs of
both business users and technical system support staff who require information relating to
the business functions available and their details. As such, the BOD is a working document
and is subject to change during the course of development and implementation.

About Business Objects


Business Objects within the environment (i.e. objects which may be drawn onto a process to
capture and replicate a part of a business process) adhere to strict guidelines in their
implementation. The definition and behaviour of the object both as seen in Process Studio
during design time and as implemented during test or via Control Room at runtime uses the
same interface definition, known as an object's capabilities. All business objects used within
Blue Prism, generic and bespoke, have a common property - Get Capabilities. The
GetCapabilities function returns an XML formatted string which defines the interfaces for that
object, their friendly names (as they appear in Process Studio) and any inputs and outputs
that are required. The Business Object Definition object captures the name, parameters,
preconditions and endpoints of each function relating to a business object and translates to
the object definition seen within Process Studio.

1.0 MS Excel VBO


The VBO replacement for the Common Automation Excel business object

The runmode of this business object is "exclusive"

1.1 Activate Workbook


Activates the excel workbook identified by the given handle and name. Params: - handle :
Number : The identifier of the instance which is holding the workbook; 0 (default) indicates
the active instance - Name : Text : The name of the workbook which should be activated

about:blank 06/24/2020
MS Excel VBO Page 2 of 26

Exceptions: - Invalid Input Parameter : If the worksheet name parameter is given - Bad
Handle : If the handle does not correspond to an Excel instance

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the workbook should be activated. The default of
zero indicates the currently active instance.
The workbook name identifying the workbook which
Workbook
In Text should be activated - empty text indicates the
Name
currently active workbook, making this a no-op.

1.2 Activate Worksheet


Activates / Creates the worksheet specified by the given parameters Params: - handle :
Number : The instance handle; - Workbook Name : Text : is the name of the workbook on
which the sheet resides / should be created; - Sheet name : Text : The name of the
worksheet - Create If Missing? : Flag : Indicates if the worksheet should be created if one
with that name doesn't exist on the workbook - if missing, it will *not* create it. Exceptions: -
Bad Handle : If the given handle did not correspond to an instance. - Workbook Not Found :
If the given workbook did not exist on the specified instance. - Worksheet Not Found : If the
given worksheet did not exist on the specified workbook.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the worksheet which should be activated resides.
handle In Number
The default of zero indicates the currently active
instance.
The name of the workbook in which the sheet exists
Workbook
In Text - The default empty value indicates the currently
Name
active workbook on the specified instance.
The name of the sheet which should be activated.
Worksheet The default empty text value indicates that the
In Text
Name currently active sheet should be, er, activated,
making this a no-op.
Create If True to create the sheet if it isn't present on the
In Flag
Missing? specified workbook; False to not do so.

1.3 Attach

Back-compatible link to 'Open Instance'. This opens the first running instance of Excel found
and links to it in this object. Returns: - handle : Number : An integer with which the instance
opened can be identified. - Enable Events : Flag : Indicates that events should be enabled /
disabled on the attached instance - defaulted to True

about:blank 06/24/2020
MS Excel VBO Page 3 of 26

Parameter Direction Data Type Description


Enable Flag to indicate that events should be enabled /
In Flag
Events disabled on the attached instance - defaulted to True
The integer handle which identifies the excel
handle Out Number
instance in subsequent actions

1.4 Attach to workbook

Back compatible link to 'Open instance' - attaches to the excel instance containing the
current workbook. Note that if the instance containing the workbook could not be found, a
new instance will be created. Params: - File name : Text : The name of the file in the
instance that should be opened. - Enable Events : Flag : Indicates that events should be
enabled / disabled on the attached instance - defaulted to True Returns: - handle : Number :
The integer that can be used to reference this instance later.

Preconditions:

Parameter Direction Data Type Description


File name In Text The name of the file which should be opened
Enable Flag to indicate that events should be enabled /
In Flag
Events disabled on the attached instance - defaulted to True
The integer handle indentifying the instance opened.
handle Out Number This can be used in subsequent actions to identify
the instance.

1.5 Close All Instances

Closes all instances of excel which have been opened by this business object, either
through "Create Instance" or "Open Instance" and which have not been discarded through
"Close Instance" or "Release Instance"

Preconditions:

1.6 Close Current Workbook


Closes the current workbook on the current excel instance. This is the equivalent of calling
the 'Close Workbook' action with the default values for 'handle' (0) and 'Workbook Name' ("")

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the workbook which should be closed resides. The
default of zero indicates the currently active instance.

about:blank 06/24/2020
MS Excel VBO Page 4 of 26

1.7 Close Instance

Closes the instance represented by the given handle, saving the changes or not as
specified. Params: - handle : Number : The handle identifying the instance that should be
closed; The default of 0 will close the 'current active' instance - ie. the last one accessed.
Note that following the 'current active' instance being closed, the current instance will not be
set. - Save Changes : Flag : True to save the instance's workbooks before closing; False to
just close the instance. Exceptions: - Bad Handle : If the given handle did not correspond to
an instance.

Parameter Direction Data Type Description


The integer handle identifying the instance to be
handle In Number
closed. Zero indicates the currently active instance.
True to save the changes to the open workbooks on
Save
In Flag the instance, False to discard any changes. Default
Changes
is False.

1.8 Close Workbook


Closes the specified workbook, saving changes if requested. Params: - handle : Number :
The integer identifying the instance on which the workbook should be closed. 0 indicates the
current instance. - Workbook Name : Text : The name of the workbook which should be
closed. "" indicates the active workbook on the specified instance. - Save Changes : Flag :
True to save the changes (the equivalent of calling 'Save Workbook' before closing the
workbook); False to discard any changes when closing the workbook. Exceptions: - Bad
Handle : If the given handle did not correspond to an instance. - Workbook Not Found : If the
given workbook did not exist on the specified instance.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the workbook which should be closed resides. The
handle In Number
default of zero indicates the currently active
instance.
Workbook
In Text The name of the workbook which should be closed.
Name
True to save the data before closing the workbook;
Save Data In Flag The default of False will discard any changes before
closing the workbook.

1.9 Copy

Parameter Direction Data Type Description

about:blank 06/24/2020
MS Excel VBO Page 5 of 26

Handle In Number
Workbook In Text

1.10 Copy and Paste Worksheet Range

Parameter Direction Data Type Description


Handle In Number
Source Workbook In Text
Source Worksheet In Text
Source Range In Text
Destination Workbook In Text
Destination Worksheet In Text
Destination Range In Text

1.11 Create Instance


Creates an instance of Excel, returning a handle with which it can be retrieved using the
global object method : GetInstance(handle).

Parameter Direction Data Type Description


Enable Flag to indicate that events should be enabled /
In Flag
Events disabled on the attached instance - defaulted to True
An integer which can be used to identify the created
handle Out Number
instance in subsequent actions

1.12 Create Workbook


Creates a workbook on the specified instance, returning the resultant name. Params: -
handle : Number : The handle identifying the instance on which the workbook should be
required. The default of zero indicates the current instance. Returns: - Workbook Name :
Text : The workbook name that Excel has granted to the new workbook. By default, Excel
will call it "Book<n>" where <n> is a positive integer. Exceptions: - Bad Handle : If the given
handle did not correspond to an instance.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the workbook should be created. The default of zero
indicates the currently active instance.
Out Text

about:blank 06/24/2020
MS Excel VBO Page 6 of 26

Workbook The name of the workbook that Excel has created -


Name this can be changed using the "Save Workbook As"
action

1.13 Create Worksheet


Creates a new worksheet in the specified workbook with the given name. If a sheet with the
given name already exists, this will activate that sheet. Params: - handle : Number : The
number identifying the instance required. - Workbook Name : Text : The name of the
workbook to add it to. An empty string (the default) indicates the active workbook in the
instance. - Worksheet Name : Text : The name of the worksheet that is required. Note that if
the name matches a worksheet already in the workbook a new worksheet will not be
created, but that worksheet will be activated. Exceptions: - Bad Handle : If the given handle
did not correspond to an instance. - Workbook Not Found : If the given workbook did not
exist on the specified instance.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the worksheet should be created. The default of zero
indicates the currently active instance.
The name of the workbook in which the sheet should
Workbook
In Text be created - The default empty value indicates the
Name
currently active workbook on the specified instance.
The name of the sheet which should be activated.
Worksheet The default empty text value indicates that the
In Text
Name currently active sheet should be, er, activated,
making this a no-op.

1.14 Cut

Parameter Direction Data Type Description


Handle In Number
Workbook In Text

1.15 Delete

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Shift (Left or Up) In Text

about:blank 06/24/2020
MS Excel VBO Page 7 of 26

1.16 Delete Worksheet

Deletes the specified worksheet from the workbook. Params: - handle : Number : The excel
instance handle - Workbook Name : Text : The name of the workbook - Worksheet Name :
Text : The name of the sheet to delete. If the sheet doesn't exist, this will fail silently - ie.
nothing will occur. Exceptions: - Bad Handle : If the given handle did not correspond to an
instance. - Workbook Not Found : If the given workbook did not exist on the specified
instance. - Worksheet Not Found : If the named worksheet did not exist on the specified
workbook, or if the active sheet was specified and there was no active sheet.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the worksheet which should be deleted resides. The
handle In Number
default of zero indicates the currently active
instance.
The name of the workbook which contains the sheet
Workbook
In Text to be deleted. The default empty value indicates the
Name
currently active workbook on the specified instance.
The name of the worksheet to be deleted. The
Worksheet
In Text default empty value indicates the currently active
Name
worksheet.

1.17 Exit
Here for backward compatibility - exits the current instance of Excel without saving any
changes.

1.18 Find Next Empty Cell

Searches for the next empty cell in the direction given. This can either activate that cell
before returning, or just return the cell reference while leaving the active cell as it was.
Params: - handle : Number : The integer handle identifying the Excel instance to use. The
default of zero indicates the 'current' instance. - Direction : Text : The direction in which to
go, this should start with "U", "D", "L" or "R" (not case-sensitive) - the rest of the string is
ignored, so you can use "Up", "DOWN" "left" and, indeed, "r" - Activate Cell? : Flag : True to
activate the found cell, False to just return the reference. Default is False. Returns: - Cell
Reference : Text : The cell ID which represents the next empty cell in the required direction.
This will be blank if no empty cell was found in the given direction. Exceptions: Invalid
Direction Parameter : If the given direction parameter was invalid - ie. did not start with one
of the (case-insensitive) letters "U", "D", "L" or "R".

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be sought. The default of
zero indicates the currently active instance.

about:blank 06/24/2020
MS Excel VBO Page 8 of 26

Direction In Text The direction in which the next empty cell is required.
This should start with any of "U", "D", "L" or "R" to find
a cell up, down, left or right respectively. The
direction parameter is not case-sensitive.
True to activate the cell which is found; False to just
Activate
In Flag return the reference and leave the active cell as it
Cell?
was before. Default is False.
The cell reference identifying the next empty cell from
Cell the active cell in the direction given. An empty value
Out Text
Reference indicates that there were no empty cells between the
active cell and a boundary.

1.19 Format Cell


Sets the number format at the given cell to that specified. Oddly, this *doesn't* set the
currently active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the cell to be formatted is contained. The default of
zero indicates the currently active instance.
Cell The reference to the cell whose format should be
In Text
Reference changed.
The format required for the cell - this can be the
name of the default format (eg. "General") or a
Cell Format In Text
sequence of formatting codes (eg. "£#,##0.00_);
[Red](£#,##0.00)")

1.20 Format Current Cell

Sets a cell format for the currently active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the cell to be formatted is contained. The default of
zero indicates the currently active instance.
The format required for the cell - this can be the name
Cell
In Text of the default format (eg. "General") or a sequence of
Format
formatting codes (eg. "£#,##0.00_);[Red](£#,##0.00)")

1.21 Format Number

about:blank 06/24/2020
MS Excel VBO Page 9 of 26

Closes all instances of excel which have been opened by this business object, either
through "Create Instance" or "Open Instance" and which have not been discarded through
"Close Instance" or "Release Instance"

Preconditions:

Parameter Direction Data Type Description


Number In Number
Number Out Text

1.22 Get Active Cell

Gets a reference to the currently active cell on the given instance.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the currently active cell is required. The default of
zero indicates the currently active instance.
Cell The reference identifying the currently active cell on
Out Text
Reference the specified sheet.

1.23 Get Active Cell Value


Gets the value of the currently active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the cell whose value is required resides. The default of
zero indicates the currently active instance.
Value Out Text The (unformatted) value found at the specified cell.

1.24 Get Cell Value


Gets the value of the specified cell - note that if the cell has some formatting set in it, this
does *not* return the formatted value - See "Get Formatted Cell Value". Note also that this
has the side-effect of making the specified cell active.

Parameter Direction Data Type Description


The integer handle identifying the instance from
handle In Number which the required cell value should be retrieved. The
default of zero indicates the currently active instance.
In Text

about:blank 06/24/2020
MS Excel VBO Page 10 of 26

Cell The cell reference indicating which cell's value should


Reference be retrieved. An empty value indicates that the
currently active cell's value should be retrieved.
Value Out Text The (unformatted) value from the required cell.

1.25 Get Formatted Cell Value


Gets the formatted value of the desired cell. This will apply any formatting which is in place
in the specified cell before outputting the value.

Parameter Direction Data Type Description


The integer handle identifying the instance within
handle In Number which the cell is contained. The default of zero
indicates the currently active instance.
The reference to the cell whose value is required.
Note that a side-effect of this action is that the
Cell
In Text specified cell will become the active cell on the
Reference
specified instance. An empty value indicates the
currently active cell.
Value Out Text The formatted value at the given cell reference.

1.26 Get Number Of Rows


Actually, I've no idea whatsoever what this does.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the number of rows is required. The default of zero
indicates the currently active instance.
The name of the workbook on which the number of
Workbook rows is required. The default empty text value
In Text
Name indicates the currently active workbook on the
specified instance.
The name of the worksheet on which the number of
Worksheet rows is required. The default empty text value
In Text
Name indicates the currently active sheet on the specified
workbook.
Number of
Out Number The number of rows.
rows

1.27 Get Worksheet As Collection

about:blank 06/24/2020
MS Excel VBO Page 11 of 26

Gets the current worksheet into a collection. This will read the worksheet and store the
contents into the collection. The first row will be treated as the column names and will be
used as the column names in the generated collection. Params: - handle : Number : The
integer identifying the instance in which the worksheet resides. Default (0) indicates the
current instance. - Workbook Name : Text : The name of the workbook on which the sheet
resides. Default ("") indicates the active workbook on the instance. - Worksheet Name :
Text : The name of the worksheet which is required as a collection. Default ("") indicates the
active sheet within the workbook. Output: Data - Collection - The data from the worksheet.
Exceptions: - Bad Handle : If the given handle did not correspond to an instance. -
Workbook Not Found : If the given workbook did not exist on the specified instance. -
Worksheet Not Found : If the specified worksheet does not exist on the specified workbook.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the worksheet which should be retrieved resides.
handle In Number
The default of zero indicates the currently active
instance.
The name of the workbook which contains the sheet
Workbook
In Text required. The default empty text indicates the
Name
currently active workbook on the specified instance.
The name of the worksheet within the specified
Worksheet workbook which should be written to a collection.
In Text
Name The default empty text indicates the currently active
worksheet within the specified workbook.
The collection containing the data from the specified
Data Out Collection worksheet - the column IDs will be gleaned from the
first row on the sheet being retrieved.

1.28 Get Worksheet As Collection (Fast)


Here for back-compatability. Should be considered deprecated and calls should be replaced
by "Get Worksheet As Collection", but right now this gets the active worksheet on the active
workbook in the current instance of Excel into a collection. It is the equivalent of calling
GetWorksheet As Collection with all the default input values. Output: Data : Collection : The
active sheet's data in a collection.

Parameter Direction Data Type Description


Data Out Collection The data output

1.29 Get Worksheet as Collection Offset

about:blank 06/24/2020
MS Excel VBO Page 12 of 26

Preconditions:

Parameter Direction Data Type Description


handle In Number
Workbook
In Text
Name
The name of the worksheet within the specified
Worksheet workbook which should be written to a collection.
In Text
Name The default empty text indicates the currently active
worksheet within the specified workbook.
StartCell In Text
Use Header In Flag
Data Out Collection

1.30 Get Worksheet Name

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Worksheet Position In Number
Worksheet Out Text

1.31 Get Worksheet Names

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the number of rows is required. The default of zero
indicates the currently active instance.
The name of the workbook on which the number of
Workbook rows is required. The default empty text value
In Text
Name indicates the currently active workbook on the
specified instance.
Worksheet A collection of worksheet names found in the
Out Collection
Names specified workbook

1.32 Get Worksheet Position

Parameter Direction Data Type Description

about:blank 06/24/2020
MS Excel VBO Page 13 of 26

Handle In Number
Workbook In Text
Worksheet In Text
Position Out Number

1.33 Get Worksheet Range As Collection

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the number of rows is required. The default of zero
indicates the currently active instance.
The name of the workbook on which the number of
Workbook rows is required. The default empty text value
In Text
Name indicates the currently active workbook on the
specified instance.
The name of the worksheet within the specified
Worksheet workbook which should be written to a collection.
In Text
Name The default empty text indicates the currently active
worksheet within the specified workbook.
StartCell In Text The starting cell of the range of interest
EndCell In Text The end cell of the range of interest
The spreadsheet data from the specified range, as a
Data Out Collection
collection

1.34 Go To Cell
Activates the cell in the given workbook, identified by the given cell reference. Params: -
handle : Number: The integer handle identifying the excel instance (0 represents 'active'
instance) - Cell Reference : Text : the cell reference to go to NOTE - the active sheet in the
instance is the one on which the cell is active

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be navigated to. The default
of zero indicates the currently active instance.
Cell The cell reference on the currently active sheet within
In Text
Reference the specified instance which should be navigated to.

about:blank 06/24/2020
MS Excel VBO Page 14 of 26

1.35 Go To Next Cell

Moves a specified number of rows and columns from the currently active cell and returns the
new cell reference. If the resultant cell reference is the same as the active cell before this
action was called, this action has 'failed'. This is usually because the active cell is too close
to a boundary.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be navigated to. The default
of zero indicates the currently active instance.
The number of rows to navigate down. A negative
Rows In Number value indicates that the action should navigate UP the
required number of rows.
The number of columns to navigate to the right. A
Columns In Number negative value indicates that the action should
navigate to the left.
The reference of the currently active cell after
navigating the required number of rows / columns. If
the action could not navigate the desired number of
Cell rows / columns (eg. the active cell is near a
Out Text
Reference boundary), then the active cell will not have been
change, and this cell reference will represent the
same cell that was active before this action was
initiated.

1.36 Go To Next Empty Cell Down


Activates the next empty cell that can be found below the active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be found. The default of zero
indicates the currently active instance.
The reference of the cell which has been found to be
Cell
Out Text empty - an empty value indicates that no empty cells
Reference
were found.

1.37 Go To Next Empty Cell Left


Activates the next empty cell that can be found on the left of the active cell.

Parameter Direction Data Type Description

about:blank 06/24/2020
MS Excel VBO Page 15 of 26

handle In Number The integer handle identifying the instance on which


the required cell should be found. The default of zero
indicates the currently active instance.
The reference of the cell which has been found to be
Cell
Out Text empty - an empty value indicates that no empty cells
Reference
were found.

1.38 Go To Next Empty Cell Right


Activates the next empty cell that can be found on the right of the active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be found. The default of zero
indicates the currently active instance.
The reference of the cell which has been found to be
Cell
Out Text empty - an empty value indicates that no empty cells
Reference
were found.

1.39 Go To Next Empty Cell Up

Activates the next empty cell that can be found above the active cell.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell should be found. The default of zero
indicates the currently active instance.
The reference of the cell which has been found to be
Cell
Out Text empty - an empty value indicates that no empty cells
Reference
were found.

1.40 Hide
Hides the window attached to the instance identified. Params: - handle : Number : The
handle identifying the excel instance to hide. The default of zero shows the currently active
instance. Exceptions: - Bad Handle : If the given handle did not correspond to an instance.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance which
handle In Number should have its window hidden. The default of zero
indicates the currently active instance.

about:blank 06/24/2020
MS Excel VBO Page 16 of 26

1.41 Hide Other Worksheets

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Worksheet In Text

1.42 Hide Worksheet

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Worksheet In Text

1.43 Import CSV

Parameter Direction Data Type Description


Destination Handle In Number
Destination Workbook In Text
Destination Worksheet In Text
Destination Range In Text
Source File Path In Text
Source Text Qualifier In Text

1.44 Insert

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Shift (Left or Up) In Text

1.45 Is Read Only


Checks if the given workbook is read only or not. Params: - handle : Number : The integer
identifying the excel instance to check. Default (0) indicates the current instance. - Workbook
Name : Text : The name of the workbook to be checked. Default ("") indicates the active

about:blank 06/24/2020
MS Excel VBO Page 17 of 26

workbook on the given instance. Output: Read Only? : Flag : True to indicate that the
workbook is read only; False to indicate that it is writable. Exceptions: - Bad Handle : If the
given handle did not correspond to an instance. - Workbook Not Found : If the given
workbook did not exist on the specified instance.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the workbook which should be checked resides. The
handle In Number
default of zero indicates the currently active
instance.
Workbook The name of the workbook to test to see if it is read-
In Text
Name only or not.
True to indicate that the specified workbook is read-
Read Only? Out Flag
only; False to indicate that it can be written to.

1.46 Move Worksheet

Parameter Direction Data Type Description


Handle In Number
Source Workbook In Text
Source Worksheet In Text
Destination Workbook In Text
Destination Position In Number
Copy In Flag

1.47 Open Instance


Opens a currently running instance of Excel. If there is no instance of Excel currently
running, this will create a new one. Params: - WorkbookName : Text : should correspond to
the workbook which should be opened - an empty value will cause the first activated
instance of Excel to be opened. Returns: - handle : Number : The numeric handle with which
this instance can be identified

Parameter Direction Data Type Description


The name of the workbook which should be opened.
Workbook
In Text An empty value indicates that the first activated
Name
instance of Excel should be opened.
Enable Flag to indicate whether events (ie. macros) should
In Flag
Events? be enabled on the given instance. Default is True
handle Out Number

about:blank 06/24/2020
MS Excel VBO Page 18 of 26

The integer handle with which the instance can be


identified in later actions.

1.48 Open Workbook


Opens a workbook using the instance specified in the given handle, opening the book
represented by the given filename. Params : - handle : Number : The handle to the instance
in which the workbook should be opened. The default value of zero indicates the current
instance. - File name : Text : The path to the file which should be opened. Outputs: -
Workbook Name : Text : The name of the workbook that Excel uses to identify it.
Exceptions: - Bad Handle : If the given handle did not correspond to an instance. - File Not
Found : If the given file does not exist or is not a file.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the required workbook should be opened. The
handle In Number
default of zero indicates the currently active
instance.
The path and name of the file which should be
File name In Text
opened.
Workbook The name used by Excel to identify the workbook -
Out Text
Name usually this is the file name (without the path).

1.49 Paste

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Values Only In Flag

1.50 Protect Workbook

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Password In Password

about:blank 06/24/2020
MS Excel VBO Page 19 of 26

1.51 Random Number

Actually, I've no idea whatsoever what this does.

Parameter Direction Data Type Description


Random Out Number

1.52 Release Instance


Removes an instance from this business object *without* closing or quitting it - after running
this action, the instance in question will not be accessible by this object unless it is re-
attached to using 'Open Instance'. Params: - handle : Number : The handle of the instance
to be released. The default of 0 indicates the currently active instance. Note that following
the current instance being released, the current instance will not be set. Exceptions: - Bad
Handle : If the given handle did not correspond to an instance.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance to be
handle In Number released. The default value of zero indicates the
currently active instance.

1.53 Remove Blank Rows


Removes blank rows in the active excel workbook. The entire row must consist of blank
cells.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required workbook should be opened. The default
of zero indicates the currently active instance.

1.54 Save Current Workbook

Saves the current workbook using the workbook name as the file name. This is the
equivalent of calling the Save Workbook action with the default values for 'handle' (0) and
'Workbook Name' ("") Exceptions: - Bad Handle : If there is no active instance. - Workbook
Not Found : If there is no active workbook on the instance.

1.55 Save Current Workbook As


Save the current workbook using the given file name. This is the equivalent of calling the
'Save Workbook As' action with the default values for 'handle' (0) and 'Workbook Name' ("")

about:blank 06/24/2020
MS Excel VBO Page 20 of 26

Params : - File name : Text : The path and name of the file to which the workbook should be
saved. Output : - New Workbook Name : Text : The new name with which the workbook is
identified within the excel instance.

Parameter Direction Data Type Description


The integer handle identifying the instance for
which the current workbook which should be saved.
handle In Number
The default of zero indicates the currently active
instance.
The full path and file name to which the current
File name In Text
workbook should be saved.
New
The new workbook name which Excel will use to
Workbook Out Text
identify the workbook.
Name

1.56 Save Workbook

Saves the workbook using the current name as a filename. Params: - handle : Number : The
integer identifying the instance on which the workbook should be saved. The default of 0
indicates the current instance. - Workbook Name : The name of the workbook to be saved.
The default of empty indicates that the active workbook should be saved. Exceptions: - Bad
Handle : If the given handle did not correspond to an instance. - Workbook Not Found : If the
given workbook did not exist on the specified instance.

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the workbook which should be saved resides. The
handle In Number
default of zero indicates the currently active
instance.
Workbook
In Text The name of the workbook which should be saved
Name

1.57 Save Workbook As


Save the given workbook using the given file name. Params : - handle : Number : The
integer identifying the instance on which the workbook resides. Default (0) indicates the
current instance - Workbook Name : Text : The name of the workbook which should be
saved. Default ("") indicates the active workbook. - File name : Text : The path and name of
the file to which the workbook should be saved. Output : - New Workbook Name : Text : The
new name with which the workbook is identified within the excel instance. Exceptions: - Bad
Handle : If the given handle did not correspond to an instance. - Workbook Not Found : If the
given workbook did not exist on the specified instance.

Parameter Direction Data Type Description

about:blank 06/24/2020
MS Excel VBO Page 21 of 26

handle In Number The integer handle identifying the instance on


which the workbook which should be saved
resides. The default of zero indicates the currently
active instance.
Workbook
In Text The name of the workbook which should be saved
Name
The full path and filename to which the workbook
Filename In Text
should be saved.
New
The new workbook name which Excel will use to
Workbook Out Text
identify the workbook within the instance.
Name

1.58 Select

Parameter Direction Data Type Description


Handle In Number
Workbook In Text
Worksheet In Text
Cell Reference In Text

1.59 Set Cell Value


Sets the specified cell's value to the given value. This has the side-effect of setting the active
cell to that which is specified here.

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the required cell value should be set. The default of
zero indicates the currently active instance.
Cell The reference on the speficied sheet identifying the
In Text
Reference cell which should be set.
Value In Text The value to which the specified cell should be set.

1.60 Set Current Instance

Sets the "current active" instance to that specified. Params: - handle : Number : The handle
of the instance that should be set as the current instance. The default of zero only has the
effect of throwing an exception if no current instance is set, otherwise it's a no-op.
Exceptions: - Bad Handle : If the given handle did not correspond to an instance.

about:blank 06/24/2020
MS Excel VBO Page 22 of 26

Preconditions:

Parameter Direction Data Type Description


The integer handle identifying the instance which
should be made the 'current' one. The default of zero
handle In Number indicates the current, er, 'current' one - ie. this action
has no effect other than validating that there is a
current instance.

1.61 Set Events Enabled

Enables or disables the events on the specified excel instance.

Parameter Direction Data Type Description


The integer identifier for the instance on which the
handle In Number events should be enabled / disabled. Zero indicates
the 'current active' instance.
Enable True to enable events on the specified instance,
In Flag
Events False to disable events

1.62 Set Window Location


Moves the specified instance's window to the required location.

Parameter Direction Data Type Description


The integer handle identifying the instance whose
handle In Number
window location should be set.
The x co-ordinate to which the window should be
X In Number
moved.
The y co-ordinate to which the window should be
Y In Number
moved.

1.63 Set Window Size


Sets the window size of the specified instance.

Parameter Direction Data Type Description


The integer handle specifying the instance on which
handle In Number
the bounds should be changed.
The width to which the instance's window should be
Width In Number
set

about:blank 06/24/2020
MS Excel VBO Page 23 of 26

Height In Number The height to which the instance's window should be


set.

1.64 Set Window State


Minimizes / maximizes / restores the window attached to the specified excel instance.
Exceptions: Invalid Input Parameter : If the given state was not "normal" and did not start
with either "min" or "max"

Parameter Direction Data Type Description


The integer handle identifying the instance whose
handle In Number
window state should be set.
The state of the window which is required. Should
start with "min" (to minimize the window), "max" (to
State In Text maximise the window) or it should equal "normal" (to
restore the window). Anything else will result in an
error.

1.65 Show
Shows a window attached to the instance identified. Params: - handle : Number : The
handle identifying the excel instance to show. The default of zero shows the currently active
instance. Exceptions: - Bad Handle : If the given handle did not correspond to an instance.

Parameter Direction Data Type Description


The integer handle identifying the instance which
handle In Number should have its window displayed. The default of zero
indicates the currently active instance.

1.66 Split Worksheet


Splits the specified worksheet into separate workbooks, creating a new sheet on each one
and copying a subset of rows across to it. Params: - handle : Number : The integer
representing the Excel instance - 0 represents the 'active' excel instance. - Rows per sheet :
Number : The number of rows which should be copied into each separate workbook. -
Workbook Name : Text : The name of the workbook from which the sheet should be split. ""
indicates the active workbook on the instance. - Worksheet Name : Text : The name of the
worksheet from which the data should be split. "" indicates the active worksheet on the
instance. - Path : Text : The directory in which the resultant workbooks should be saved. -
No Title Row : Flag : True to indicate that the first row should *not* be used as a title row and
copied across each of the generated workbooks. Exceptions: - Bad Handle : If the given
handle did not correspond to an instance. - Workbook Not Found : If the given workbook did
not exist on the specified instance. - File Not Found : If the given path did not exist or was
not a directory

about:blank 06/24/2020
MS Excel VBO Page 24 of 26

Parameter Direction Data Type Description


The integer handle identifying the instance on which
the worksheet which should be retrieved resides.
handle In Number
The default of zero indicates the currently active
instance.
Rows per The number of rows which should appear in each
In Number
worksheet worksheet. Zero indicates all rows.
The name of the workbook within the specified
instance which contains the sheet to be split. The
Workbook
In Text default empty text indicates the currently active
Name
workbook within the specified instance should be
used.
The name of the worksheet within the specified
Worksheet workbook to split - The default empty value indicates
In Text
Name that the currently active sheet within the workbook
should be used.
True to indicate that the rows should just be split
across without using the first row as a title row (ie. as
No Title
In Flag a list of column headers). False to indicate that the
Row
first row contains the column headers which should
be replicated across all generated sheets.
The path to the directory in which the generated
workbooks should be created. The files will be
Path In Text created with a name of "{Workbook Name}
_SECTION_nnnn", where nnnn is an number
incrementing with each section generated.

1.67 Unhide All Columns


Gets the current worksheet into a collection. This will read the worksheet and store the
contents into the collection. The first row will be treated as the column names and will be
used as the column names in the generated collection. Params: - handle : Number : The
integer identifying the instance in which the worksheet resides. Default (0) indicates the
current instance. - Workbook Name : Text : The name of the workbook on which the sheet
resides. Default ("") indicates the active workbook on the instance. - Worksheet Name :
Text : The name of the worksheet which is required as a collection. Default ("") indicates the
active sheet within the workbook. Output: Data - Collection - The data from the worksheet.
Exceptions: - Bad Handle : If the given handle did not correspond to an instance. -
Workbook Not Found : If the given workbook did not exist on the specified instance. -
Worksheet Not Found : If the specified worksheet does not exist on the specified workbook.

Preconditions:

Parameter Direction Data Type Description

about:blank 06/24/2020
MS Excel VBO Page 25 of 26

handle In Number The integer handle identifying the instance on which


the worksheet which should be retrieved resides.
The default of zero indicates the currently active
instance.
The name of the workbook which contains the sheet
Workbook
In Text required. The default empty text indicates the
Name
currently active workbook on the specified instance.
The name of the worksheet within the specified
Worksheet workbook which should be written to a collection.
In Text
Name The default empty text indicates the currently active
worksheet within the specified workbook.

1.68 Worksheet Exists

Parameter Direction Data Type Description


The integer handle identifying the instance on which
handle In Number the number of rows is required. The default of zero
indicates the currently active instance.
The name of the workbook on which the number of
Workbook rows is required. The default empty text value
In Text
Name indicates the currently active workbook on the
specified instance.
Worksheet The name of the worksheet of interest; it will be
In Text
Name checked for existence
Worksheet
Out Flag Indicates whether or not the named worksheet exists
Exists

1.69 Write Collection


Writes the given collection into the specified sheet.

Parameter Direction Data Type Description


The integer handle identifying the instance on
which the specified collection should be written.
handle In Number
The default of zero indicates the currently active
instance.
The collection containing the data which should be
Collection In Collection
written to the worksheet.
The name of the workbook within which the data
Workbook should be written. The default empty value
In Text
Name indicates the current workbook within the specified
instance.

about:blank 06/24/2020
MS Excel VBO Page 26 of 26

Worksheet In Text The name of the worksheet on which the given


Name data should be written. The default empty value
indicates the current sheet within the specified
workbook.
Cell The reference at which the collection should be
In Text
Reference written.
True to indicate that the column names from the
Include
collection should be written out as the first row;
Column In Flag
False to ignore the column names and just write
Names
out the data.

1.70 Write To Clipboard

Parameter Direction Data Type Description


Value In Text

about:blank 06/24/2020

You might also like