LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW + Excel Macros

All,

 

I recently acquired Lab-view to automate a process of manually inputting data into a spreadsheet and running the macro to calculate the final results. I want to be able use the read-in data from the sensors, populate the appropriate cells with that data, and continuously run the macro. With this I can simply observe the results until satisfactory as opposed to going taking hand measurements and re-inputting the data.

 

I was pointed at Report Generation Toolkit VI perhaps that could do this? 

 

Any help would be great. 

0 Kudos
Message 1 of 9
(4,361 Views)

I have not used this particular feature before personally but it does look like the report generation toolkit has functionality to run macros.

Niatross_0-1582646632957.png

The report generation toolkit isn't particularly intuitive in my opinion, especially if you haven't used LabView before. I would possibly consider doing any data processing that your macro does and display the data using your LabView code. Once you are happy you can then write that data to file. Without knowing exactly what you are doing it is difficult to offer more advice.

0 Kudos
Message 2 of 9
(4,341 Views)

I see. Since I am using the DAQAssistant to gather all the data from 10 or so sensors, it would be nice to read in the data through Labview, and some how use this sensor data to feed into the macro and display the macro results to Labview. 

 

Sorry if i am being vague. 

0 Kudos
Message 3 of 9
(4,330 Views)

Niatross' suggestion is presumably that since you are gathering your data in LabVIEW (by the way, take a look at Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications) and you want to do some calculations based on that data, and LabVIEW is a fully-featured programming language, you could directly do those operations with LabVIEW.

 

No Excel macros required.

 

After you have the results, you could then optionally store them in a csv file (Write to Text File, or Write Delimited Spreadsheet, or similar, can be opened with Excel) or an xls(x) file (Report Generation Toolkit).

 

This might be easier than trying to communicate back and forth between the two applications.


GCentral
Message 4 of 9
(4,314 Views)

Cbutcher is right. I cannot really think of any reason where you might want to communicate data to a excel macro rather than do the processing and most of the visualisation in LabVIEW. 

0 Kudos
Message 5 of 9
(4,296 Views)

@Worle wrote:

Cbutcher is right. I cannot really think of any reason where you might want to communicate data to a excel macro rather than do the processing and most of the visualisation in LabVIEW. 


It's useful for generating reports. I need to display some data in a spreadsheet with multiple plots. It's far easier to do that in Excel than to create an Excel plot within LabVIEW.

 

For processing data, it's almost always simpler to do it in LabVIEW then send the result over, but formatting Excel from LabVIEW is quite tedious.

0 Kudos
Message 6 of 9
(4,283 Views)

I should have been more clear. The reason i want to do this some what round about way, is to avoid having to completely transcribe 400 lines of excel macro into Labview code.

0 Kudos
Message 7 of 9
(4,245 Views)

I should have been more clear. The reason i want to do this some what round about way, is to avoid having to completely transcribe 400 lines of excel macro into Labview code.

0 Kudos
Message 8 of 9
(4,243 Views)

Yes, there is a way using ActiveX. This VI is setup to run a function macro (e.g. function mymacro(Arg1 As String, Arg2 As String) As String) and then close Excel.

 

But you can delete the arguments to run it as a sub instead and tweak the closing logic to leave Excel open as needed. 

0 Kudos
Message 9 of 9
(4,196 Views)