262 Chapter 6
Creating Reports Easily Using ActiveX
Sending Agilent VEE Data to MS Excel
The entries in the Formula object are as follows:
11.Save the program as
results_average.vee. Run the program. MS
Excel will launch with a worksheet like the one shown in Figure 6-9.
Figure 6-9. Excel Worksheet for “Results Average” Program
set range =
sheet.range(“A2:A21");
Sets the VEE variable range to
reference the range
A2 to A21 on
the Excel worksheet. (
A refers to the
first column in a worksheet.)
range.NumberFormat =
“##,#00.00";
Assigns the format to each of those
cells with the pound signs (
#)
allowing for larger numbers, if
necessary.
app.worksheetFunction.average
(range);
Calls an Excel method
average()
that returns the average value of the
designated
range of values, which
is displayed in
Results Average.