LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VBA dll labview Array

I created a function in LabVIEW, and I  call it  from VBA ( Access in my case , but it would be the same from Excel). The idea is to pass parameters , and get back an array.

In the option of communicating with the function in VI , I have no problems, but when I compile and I try it with a  dll, It doesn´t work.

 

I´m only able to use double or integer parameters, but when I try to pass an array or cluster, I´m not able.

 

In the zip, it is the labview project , and two dll created differently ( in the word there is an explanation of both possibilities)

 

I have also added the Access to see the VBA code .

 

Anyway , I copied the VBA code :

 

 

 

 

 

 

Private Declare Function Salvar Lib "C:\ComunicacionVBA\SharedLib.dll" (ByVal y As Double, ByVal x As Double, ByRef Vector As Variant, ByRef Longitud As Integer) As Double
Private Declare Function Salvar2 Lib "C:\ComunicacionVBA\SharedLib2.dll" (ByVal y As Double, ByVal x As Double, ByRef Vector As Variant) As Double
'Option Compare Database


Private Sub Comando2_Click()
Dim x, y As Double
Dim Vector As Variant
Dim Longitud As Integer

x = 1
y = 2

x = Salvar(y, x, Vector, Longitud)

MsgBox (x)

MsgBox (Longitud)

MsgBox (Vector)

End Sub

Private Sub Comando3_Click()
Dim x, y As Double
Dim Vector As Variant


x = 1
y = 2

x = Salvar2(y, x, Vector)

MsgBox (x)


MsgBox (Vector(0))

End Sub

0 Kudos
Message 1 of 1
(2,648 Views)