Specifications

5.1.3.3 Application Output
The figure below shows the displayed results when the
application is executed.
5.1.4 Microsoft Excel Example
5.1.4.1 Application Configuration
Microsoft Office 2000 was used for this example. This
version of Office contains Visual Basic for Applications
(VBA) which allows developers to attach Visual Basic
Macros to Excel documents. The type library for the
PNA network analyzer should be referenced in the
Visual Basic development environment. The following
figure illustrates the reference. In this example the
“Create Object” method will look at the configuration of
DCOM to see what network analyzer to connect to. The
code below must be copied and placed in the Visual
Basic editor for the Excel worksheet object as shown
below.
5.1.4.2 Application Code
The application code is contained below. The program
inserts the data retrieved from the analyzer into cells in
the Excel document. The cells are then used to update a
graph in the Excel document. To run the application,
open the document using Microsoft Excel. Enable
macros when prompted by the application. Once this is
complete, the application will execute and update the
document. It can be run on a PC or the PNA analyzer.
Option Explicit
Dim app
Dim chan
Dim meas
Dim result As Variant
Dim i As Integer
Dim num_points As Integer
Private Sub Workbook_Open()
' Connect to the PNA application on machine SLTSU044
Set app = CreateObject("AgilentPNA835x.Application")
' Reset the analyzer to instrument preset
app.Reset
' Create S11 measurement
app.CreateMeasurement 1, "S11", 1
' Set chan variable to point to the active channel
Set chan = app.ActiveChannel
' Set meas variable to point to the active measurement
Set meas = app.ActiveMeasurement
' Setup the channel for a single trigger
chan.Hold True
app.TriggerSignal = naTriggerManual
chan.TriggerMode = naTriggerModeMeasurement
' Make the PNA application visible
app.Visible = True
' Set channel parameters
chan.NumberOfPoints = 11
chan.StartFrequency = (1000000000#)
chan.StopFrequency = (2000000000#)
' Send a manual trigger to initiate a single sweep
chan.Single True
' Store the data in the "result" variable
result = meas.GetData(naRawData,
naDataFormat_LogMag)
' Display the result
num_points = chan.NumberOfPoints
14