LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Simulate Button Press

I have an excel file containing data and some macros. I'd like to use LabVIEW to automate the pressing of a command button which has a macro assigned to it. Is there a way to do this through the ActiveX properties and methods Excel exposes?

 

Thanks,
Craig

0 Kudos
Message 1 of 5
(3,106 Views)

Hi Craig,

I don't know how to automate the pressing of a command button through ActiveX properties in Excel but if you have Visual Basic you can create an exe for your excel file and call this exe with LabVIEW.

To call an exe with LabVIEW use system exec.vi

Charly

It's always sunny in California! Certified LabVIEW Associate Developer!
Message 2 of 5
(3,102 Views)
Message Edited by CharlyStardust on 09-08-2008 04:21 PM
It's always sunny in California! Certified LabVIEW Associate Developer!
0 Kudos
Message 3 of 5
(3,102 Views)

That's a thought. An *.exe would not be the ideal case since versions of this excel file are updated by a different team of people. Perhaps there's a way to invoke a macro to run so that I can just call the macro directly since its prototype never changes?

 

Craig

0 Kudos
Message 4 of 5
(3,063 Views)

Ok. I figured it out. I was asking the wrong question. I really just want to run a macro and it looks like there have been plenty of people on this forum that have asked the same thing.

 

Solutions:

1) LabVIEW 8.5 has some examples of calling macros (just search 'macro' in the example finder)

2) You can also use the "Run Macro VI" in the report generation toolkit

http://zone.ni.com/reference/en-XX/help/372120A-01/lvoffice/excel_run_macro/

 

 

I ended up using the example provided by NI to guide me. The Application instance has a method of "Run" which allows you to call a macro by its XLS file and name (e.g. myDoc.xls!Button_Click_1)

 

Thanks!

Craig

Message 5 of 5
(3,060 Views)