LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger Excel Macro From LabVIEW NXG

Hello,

 

I'm using LabVIEW NXG 3.1 and I currently have a program which logs data over time to a .csv file.  I then have a macro-enabled excel worksheet which I run that processes that raw data and stores it in the worksheet.  Does anyone know of a way to automatically trigger an excel macro from LabVIEW?

 

Thanks,

Gabe

0 Kudos
Message 1 of 3
(2,020 Views)

Hello, 

 

On LabVIEW NXG 3.1 the Excel related VI's are limited to report generation, so,  Close Excel Report, Create Excel Datasheet, Insert Excel Chart and New Excel Report. 

However on LabVIEW (not NXG), there's a VI called Excel Run Macro VI which seems to be what you're looking for.

 

Hope it helps!

0 Kudos
Message 2 of 3
(1,934 Views)

The Report Generation Toolkit is still in work for LabVIEW NXG so there is no direct way yet (you can use the .NET Interface Document and call the Microsoft.Office.Interop.Excel interop assembly directly if you are adventurous).

 

However, you can call LabVIEW from LabVIEW NXG using VI Interop (G Dataflow) You can use function that Fujica35 mentioned. A good example is below. I modified the example to pass in the VBA macro string from LabVIEW NXG and execute the example in LabVIEW 2019. Note that you will need both LabVIEW and LabVIEW NXG installed.

 

C:\Program Files (x86)\National Instruments\LabVIEW 2019\examples\Report Generation\Excel Reports\Excel Report - Run Macro.vi

 

Run Macro with LV Interop.png

 

Thanks,

Frank

0 Kudos
Message 3 of 3
(1,902 Views)