Problem executing Excel macro from matlab
Mostra commenti meno recenti
Hi,
I'm doing a project that inputs an excel file, does some modifications on it, exports to a new one.
Everything works, up until I try to access a macro in my output file, then I get this:
Error using Interface.Microsoft_Excel_14.0_Object_Library._Application/Run Invoke Error, Dispatch Exception: Source: Microsoft Excel Description: Cannot run the macro 'Macro1'. The macro may not be available in this workbook or all macros may be disabled. Help File: xlmain11.chm Help Context ID: 0
Error in TEST (line 49) invoke(app,'Run','Macro1');
When I try to give it a fully qualified name, it changes the error to complaining
Error using Interface.Microsoft_Excel_14.0_Object_Library._Application/Run Invoke Error, Dispatch Exception: Source: Microsoft Excel Description: 'C:\Users\nitza\Documents\PERSONAL.XLSB' could not be found. Check the spelling of the file name, and verify that the file location is correct.
If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. Help File: xlmain11.chm Help Context ID: 0
Error in TEST (line 49) invoke(app,'Run','PERSONAL.XLSB!Macro1');
Now, the macro is defined in something called "Personal.xlsb", my file is "output.xlsb". The attachment shows how excel has arranged it.
How do I access the macro? Thanks.
3 Commenti
Image Analyst
il 10 Lug 2015
How are you trying to run it? Is it something that runs immediately and automatically when the workbook is opened? Are you using ActiveX to fire off the macro? Are you even using ActiveX at all? If so, what are your lines of code to run the macro.
Nitza Burck
il 10 Lug 2015
Modificato: Nitza Burck
il 10 Lug 2015
Image Analyst
il 11 Lug 2015
What is an xlsb file? I only use xlsx files. If you attach your workbook, people can try the code.
When you open it in Excel, it doesn't have a yellow banner at the top with a button that say "Enable editing" does it?
Risposte (0)
Categorie
Scopri di più su Use COM Objects in MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!