Ok so that was pretty dumb, BUT better documentation
WOULD have help me avoid this problem.
The answer is obvious. Well, maybe.
GetControlValue returns a Var, so the LV "To G" VI fixed the problem.
Dave
wrote in message news:3afafe9e@newsgroups....
> I am having a problem getting a string array from an LV app into the VBA procedure.
>
> I am trying to "bullet-proof" (idiot-proof) an application to read some data
> from an instrument and insert it on demand into cells of an Excel spreadsheet.
> The user clicks a button on the spreadsheet and the VBA app (the client) gets
> data from the VI executable (the ActiveX server).
>
> The problem I'm having is that the array of strings appears to be empty.
> I am using the VI.GetControlValue("StringArrayControlName").
>
> The VBA code looks like:
>
> '(this is a test program to do exactly the same thing,
> ' but using the time to generate the changing string(s) so that the data can be ~live)
> ' these are global dims
> Dim lvApp As AX_Time3RDR.Application
> Dim VI As AX_Time3RDR.VirtualInstrument
> Dim VIPath As String
> Dim strTimeData(1 To 16) As String
> '
> ' This is in a launch app subroutine. (on launch button clicked)
>
> Set lvApp = CreateObject("AX_Time3rDR.Application")
> VIPath = lvApp.ApplicationDirectory + "\" + lvApp.AppName + "\" + "AX_TimeRDR.vi"
> Set VI = lvApp.GetVIReference(VIPath) 'this runs it too!
> '
> '
> ' this is in a read data subroutine (on read button clicked)
>
> strTimeData = VI.GetControlValue("Time Data")
> ' this generates a VB compile error as is,
> ' but if I put an index on strTimeData, it only acts on the indexed element.
> ' Of course, the (MY) problem is that the returned data seems to be empty.
>
> Sheet1.Cells(3, 4) = strTimeData(1)
> Sheet1.Cells(4, 4) = strTimeData(2)
> '
> '
> '
> ' and of course when I'm done, I quit the LV exe with
> ' on quit button clicked subroutine.
> lvApp.Quit
>
> I'm using LV 5.1.1 PDS and Excel 2K.
>
> Thanks
> Dave Karon
> Concepts NREC
>
>
>
>