From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VBA and LabVIEW data Exchange

I have an Instrument that can be read only by the software provided by the manufacturer. The Software has visual basic for applications (vba) and I'd like to take the values, queue in LabVIEW for further processing and storage. Then I'd like to call a method in vba passing the result of processing in LabVIEW.


My problem is what is the best way to interface Visual Basic and LabVIEW? I could for example write the values in a text file and read from LabVIEW and vice versa but I think this is far from the best practice of programming.

 

So I have a event an routine in VBA like that below. I Would like to Queue Value1,Value2 and Value3 in LabVIEW.

 

Private Sub Value_Change(ByVal Value1 As Integer, ByVal Value2 As Integer, ByVal Value3 As Integer)

'Need to Queue Value1, Value2 and Value3 in LabVIEW

End Sub

 

 

 

Then I'd like to call a subroutine in VBA passing the result:

 

labview.png

thanks 

Paul

 

 

 

0 Kudos
Message 1 of 7
(3,264 Views)

If you have access to the VBA source code, you re-write it in LabVIEW.

You don't interface LabVIEW to VBA.

0 Kudos
Message 2 of 7
(3,240 Views)

As I think, you should specifed the "Software" for asking an answer.

0 Kudos
Message 3 of 7
(3,225 Views)

The software and is called THD traceability Viewer and it shows the value and information of position sensors. It is installed with the instrument, which doesn't communicate with a simple protocol, like OPC or TCP so I need the software.

This software has a software development kit with many functions, and examples of use in VBA. I don't think rewrite in LabVIEW its a good idea because, the code is not so simple and it works great.

0 Kudos
Message 4 of 7
(3,199 Views)

@rick2008 wrote:

 

This software has a software development kit with many functions, and examples of use in VBA. I don't think rewrite in LabVIEW its a good idea because, the code is not so simple and it works great.


Then, you'll be forced to use their software.

 

 

0 Kudos
Message 5 of 7
(3,182 Views)

I am using the software and I will use. LabVIEW will not replace it in anyway. I am using LabVIEW to do something more, like mathematical models.
The problem is the interface between VBA and LabVIEW. I am writing the values in a text file, reading through LabVIEW, processing the information and returning set-points to the software in the same way: Writing a text file and reading through VBA.
The question is, is there a better way to do this instead text files? I think there must be some, and I am asking for your help.

 

 

Thank you all

0 Kudos
Message 6 of 7
(3,151 Views)

Chances are good that you can translate the VBA examples to LabVIEW easily. You wouldn't rewrite their software, you would just access it differently. I assume their code is not actually written in VBA, rather they provide an ActiveX or similar component that can be accessed from multiple languages and they just chose to use VBA for their examples. If so, you should be able to access that same component from LabVIEW. If you provide an example of the VBA code, we can probably explain how you would do the same thing in LabVIEW.

0 Kudos
Message 7 of 7
(3,145 Views)