LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get LabVIEW to execute excel macro (written in Visual Basic)?

Hi. I have written some code in C and placed it as a macro module in my excel spreadsheet. I would like to call and execute that code from LabVIEW 6.1, and return the values of the function. I've read all the various discussion forum postings and example VI's, but I still do not have a clear understanding of what to do.

I also saw that it is possible to convert the Visual Basic code to a .dll format, and then that file can be called from LabVIEW. How do I make that .dll file from Visual Basic?
0 Kudos
Message 1 of 2
(2,626 Views)
Use the Example VI Open Excel and Make Visible.vi to open Excel. Wire up the Application ref to proberty WorkBooks and then cascade to Method Open. Open the Excel workbook that contains your macro functions.

Then wire Application ref to Method Run. There you can specify the name of the macro and any arguments. A variant will be returned if you call a function. I am using LV6.1 and Excel XP.

You will need a Visual Basic compiler to make a DLL out of your code.

Michael
www.abcdefirm.com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 2 of 2
(2,626 Views)