LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Application.Run line in macro does not work

I am using "Excel Run Macro.vi" from the MSoffice report generation toolkit, to run an Excel macro. The macro has a line "Application.run "ATPVBAEN.XLA!Histogram", which is calling an excel add-in, to make a histogram chart (not one of the normal Excel charts). The macro works when I run it by itself. When LabView calls the macro, I get an error that the .XLA cannot be found. Is this because Labview would be the "application"? Any thoughts?
0 Kudos
Message 1 of 3
(3,279 Views)
When you run Excel on its own, the default directory, start directory and work directory are all set by Excel. When you call Excel from another application, these directories are set by the calling application. Excel may not know where to find your histogram generator. As a test, try calling the histogram generator using an explicit path or copy the .XLA into the same directory that your LV VI is in. Either of these should solve the problem.

Rob
0 Kudos
Message 2 of 3
(3,279 Views)
Hi Rob, what you suggested makes good sense, but, I tried both and it still does not work. It either can't find the file, or, it states that there is already a file of the .xla name open already. The errors are coming from VB. I am wondering if I need to use the "create VB reference" VI in my labview project, but I am having trouble finding an example of how to use with with the "run macro" VI. When I create the new report in LV, I am using the macro spreadsheet as a template. Anybody out there using these VIs?
0 Kudos
Message 3 of 3
(3,279 Views)