Chapter 6 Using Measure Data Acquisition Tasks with VBA
Measure Data Acquisition User Manual
6-2
© National Instruments Corporation
Parameters
Option
Description
TaskName
The name of a task in the active workbook.
NewTargetRange
The address of a range on a worksheet that receives the acquired data.
If you fail to specify a worksheet explicitly in the address of this
macro, Measure assumes that the range is on the active worksheet. If
no worksheet is active, Measure returns an error. If this parameter is
missing, Measure uses the previously configured range
ReferenceStyle
Use either xlA1 or xlR1C1 to indicate the type of range address being
passed into NewTargetRange. If this parameter is missing, then
Excel’s current reference type is assumed.
Return Value
Returns
0
if successful, otherwise returns an error code. See Appendix B, Error Codes
for more information.
Example
‘Referenced not added to DAQ Add-In; use indirect method
Sub RunMyTask()
Dim iErr As Integer
iErr = Appliction.Run(“DAQ”, “AI1”)
If iErr <> 0 Then
MsgBox Application.Run(“GetDAQErrorMessage”, iErr)
End If
End Sub
‘Referenced added to DAQ Add-In; use direct method
Sub RunMyTask()
Dim iErr As Integer
iErr = DAQ(“AI1”)
If iErr <> 0 Then
MsgBox GetDAQErrorMessage(iErr)
End If
End Sub