LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running Excel VBA code (contained in an .xlam file) in LabVIEW

Hi all,

 

I have a project whereby I'm trying to convert some VBA macro functionality into LabVIEW and I found out that you can actually just run the vba code in labview using the VIs Import Module>>Run Module>>Remove Module.

 

However I would have to change modify some of that code. What it essentially does is to call one Excel file, look at the data and transfer to a different excel file. Normally, while running the macro in Excel, a couple of list boxes appear and based on what the user enters, an excel file is called up from a certain path.

 

For example in the VBA, the path for the excel file to be opened is defined as such:

 

Set wbSample = Workbooks.Open(TextBoxPath & "\" & ListBoxPath.Value)
Set wbSample = ActiveWorkbook
Set shtProtocoll = wbSample.Worksheets("Protocoll")

 

My question is

 

1) How to insert the path (which Labview builds based on user input on the front panel) into the above vba code without using ActiveX? Reason being I want to maintain the original macro (whereby the user interacts with vba objects such as list boxes) and also be able to access the functionality through Labview

 

2) If the vba code contains a private sub, do I have to convert to public sub to allow LabView to access it (There are a bunch of different subs in the code)?

 

Thanks in advance!

0 Kudos
Message 1 of 1
(804 Views)