I found a couple of work-arounds for VBA, using the Shell command:
To open DAQami, and start recording using the default configuration:
Sub OpenDAQ()
'Opens DAQami using the Shell command
Shell "C:\Program Files\Measurement Computing\DAQami\DAQami.exe", vbNormalFocus
'Wait 2 seconds after starting
DoEvents
Application.Wait Now + TimeValue("00:00:02")
'select the last saved configuration
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{ENTER}", True
'start recording
Application.Wait Now + TimeValue("00:00:01")
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{ENTER}", True
'shift focus back to Excel
Application.Wait Now + 0.000005787
AppActivate "DAQ - Excel"
Workbooks("DAQ.xlsm").Activate
Sheets("Report").Activate
'start the subroutine that checks for the DAQ recording status
Call CheckForDAQRecording
End Sub
To close DAQami, and save the data and configuration:
Sub CloseDAQ()
'Return focus to DAQami
On Error GoTo stepout
AppActivate ("DAQami - [Configuration: system.amicfg] [Data File: DAQdata.tdms]")
DoEvents
Application.Wait Now + TimeValue("00:00:01")
'Request close program
SendKeys ("%{F4}"), True
SendKeys ("+{TAB}"), True
'Enter to confirm stop recording
Application.Wait Now + TimeValue("00:00:01")
SendKeys "{ENTER}", True
'Enter to save configuration
Application.Wait Now + TimeValue("00:00:05")
SendKeys "{ENTER}", True
stepout:
End Sub
To find out if DAQami is recording:
Dim recFDT
recFDT = Dim recFDT
recFDT = FileDateTime("C:\Users\XXXXXX\Documents\Measurement Computing\DAQdata.tdms")
I then subtract NOW() by recFDT and if it's less than 1.5 minutes, I know the data is current.