LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have problem with running excel macro in report generation tool kit

I am trying to use Excel Run Macro.vi but run into a problem: Exception occured in Microsoft Excel, The macro 'personal.xls!Macro1' cannot be found.. Help Path is C:\Program Files\Microsoft Office\Office\1033\xlmain9.chm and context 0 in Excel Run Macro.vi->example.vi
Also I tried to save the macro under the file that is active and I get the same results.
I saved the macro as *.bas file and ran it using Excel Import Module and did not see any erreos and it did not do anything.
Where a re some god examples that use the excel marco feature using the new report generation vis?
0 Kudos
Message 1 of 8
(3,373 Views)
masoud,

Try this example out and let me know if you have any more questions. Also, this is in LabVIEW 6.1 format. If you need it in a different format, please let me know.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
Download All
0 Kudos
Message 2 of 8
(3,371 Views)
I am having also having a problem of running the Excel macro.  I created the graph in Excel using the report generation toolkit.  After,I created an Excel Macro to make a few small alterations.  Then, I ran the macro and nothing will happen.  Does this have to do with the MS Graph   I have not used the vi for using the macro, I am trying to do it throught Excel for now.  Does anyone know how to solve this problem. Thanks
0 Kudos
Message 3 of 8
(3,287 Views)
In Excel, go to Tools >> Macro >> Security

In the security level, make sure it is either medium or low.

In the trusted source level, check both "Trust all addins" and "Trust access to Visual basic project"

btw, make sure the "error in" input to the "Excel Remove Module" vi is always NO error, in case something happens so it will dispose the macro reference properly, otherwise you will have multiple instances of the macro in the system.

-Joe
0 Kudos
Message 4 of 8
(3,287 Views)

I did this and got an Excel error

Run-time error '438': Object doesn't support this property or method. 

0 Kudos
Message 5 of 8
(3,280 Views)
You need to use these VIs in order:

Excel Import Module.vi
Excel Run Macro.vi
Excel Remove Module.vi

I alway pass the macro cold in as string. but if you have a file, you can also loaded. In this calse, the macro code should be empty.

-Joe
0 Kudos
Message 6 of 8
(3,277 Views)
I had not used any vis to run the macro.  I created it and tried to run it without labview after it had created the graph and saved the excel file.  Is this causing a problem?  It seems hard to believe.  Thank you for your help.
0 Kudos
Message 7 of 8
(3,276 Views)
i thought you've done all this in labview.

anyway, make sure the macro is operating to the correct workbook and worksheet. Does the macro uses/modifies the graph/chart in excel? If so, make sure the chart window title it referenced is the same as the chart in the worksheet. you can find the chart name by right click on the chart and select "Chart Window", it should show a window around the chart, write down the title and use it in your macro.

or you can attach your excel file.

-Joe
0 Kudos
Message 8 of 8
(3,271 Views)