02-25-2020 09:24 AM
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.
02-25-2020 10:06 AM
I have not used this particular feature before personally but it does look like the report generation toolkit has functionality to run macros.
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.
02-25-2020 10:44 AM
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.
02-25-2020
11:26 AM
- last edited on
01-13-2025
08:25 AM
by
Content Cleaner
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.
02-25-2020 12:30 PM
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.
02-25-2020 01:35 PM - edited 02-25-2020 01:38 PM
@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.
02-26-2020 10:18 AM
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.
02-26-2020 10:19 AM
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.
03-02-2020 02:02 PM
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.