Chapter 6 253
Creating Reports Easily Using ActiveX
ActiveX Automation in Agilent VEE
VEE uses standard Microsoft Visual Basic syntax to create the commands or
statements like those shown in Figure 6-3. The commands or statements
perform three types of operations: get properties, set properties, or call
methods.
n Get property statements usually refer to getting some type of data. The
syntax is <object>
.<property>. For example, sheet.application
gets the
application property of the sheet object.
n Set property statements usually refer to setting some type of data equal to
something. The syntax is <object>
.<property> = <property type>. For
example,
object.property = MaxSize sets a property.
n Call methods call a
method. A method requests the object to perform an
action.
Methods have parameters that allow data to be passed in and
returned. The syntax is <object>
.<method>(parameters).
Note The syntax for data type Objects looks similar to the VEE syntax for
getting a Record field,
rec.field, and calling a UserFunction,
myLib.func(), so it is important to assign descriptive names to variables.
Using CreateObject and GetObject
Notice that one of the statements in Set Up Excel Worksheet in Figure
6-3 contains the
CreateObject() function call. CreateObject() and
GetObject() are functions in the VEE Function & Object Browser,
and they are designed specifically to return a pointer to an ActiveX object in
VEE.
For example,
CreateObject("Excel.Sheet")starts up Excel and
returns a reference to a workbook in it. (The Microsoft statement “sheet”
returns a workbook.) Use
GetObject() to get something or some data that
already exists in a running Excel, or to load a file into a running Excel.
CreateObject and GetObject are located under Device ⇒ Function
& Object Browser
, Type: Built-in Functions, Category:
ActiveX Automation
. Figure 6-4 shows an example CreateObject and
GetObject.