I had Labview running macros fine. I added a new macro and case structure to add this feature, now it gives me an error on all macros. 'cannot run macro', 'may not be available', may not be enabled' is the jist of the error. In addition, the labels for the case structure are now red. I checked spelling and order. tha tonly thing I can think of is that I added a case before I added the enumerated constant. I have added cases before and have never had a problem, macros work when run manually, they are all in personal.xlsm!.
Solved! Go to Solution.
one thought I had was that I modified it and saved. recently, I had upgraded to 2011. maybe the excel toolkit has partial funstionality b/c I haven't added the toolkit to 2011? still opens file, but does not run macro. Excel has macros enabled still....
ok, the case structure had to have the emun constant relinked up through the subvis. at least the case structure is happy now. all labels on cases are black. we will see if that is a fix. it was opening the file and loading the personal.xlsm!, just no macro run.
well, I downloaded the one here. when we were running 2010, I am not sure where we got it. I did notice that I had to load vi thru llb manager instead of using the palettes. not sure if that was normal or b/c I updated to 2011. I did not make original subvi, so I wasn't sure.
is it possible that 2011 does not support all older excel toolkit features? anyway, it still does not work. it opens the file but fails at the macro.
Cna you provide some more precise details on the setup you had when this was working? The subVIs in the VI you attached that deal with excel do not seem to be part of the Report Generation Toolkit, which is what contains all the VIs that deal with excel. I have included a link to an example that shows how to run a macro in excel from LabVIEW. Does this example look similar to what you had implemented in this code at some point?
If you updated to LabVIEW 2011 you will need to update the Report Generation Toolkit to the 2011 version. Refer to this article for information on compatibility of LabVIEW and Report Generation Toolkit:
He is NOT using the Report Generation Toolkit as he has already posted.
There is something called Excel Toolkit. http://zone.ni.com/devzone/cda/epd/p/id/2974
Something probably broke when he upgraded to LabVIEW 2011. Not sure what is in the VI he posted since it is in LV 2011.
alright, I figured it out. I thought it was a LabView update issue since these events were close together. anyway, it had to do with VBA oddities. when you import a .bas file, the name is listed on the LH sidebar is:
and the first line of code is
so you wont catch it on the VBA page. when you goto the "view" tab in excel and hit the macro button, you will notice that the name gets doubled.
if the macro is in module 1 listed on that LH sidebar, the name is listed normally when you open it from excel. Sidenote, recorded macros go into this Module 1, any other time, the name doubles, or sometimes triples as listed above. it can get a little silly if you export new versions and reimport them for modification. the way VBA saves and exports/imports is a little different than most other programs. like a 90's throwback. anyway, lesson learned.