how to run a Macro from excel in MATLAB
48 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello ,
i have a macro in excel programed in Visual Basic. I need to run it from MATLAB or coding it again in MATLAB language. How can i do it automatically?
I have MATLAB R2013b
Thank you so much!
0 Kommentare
Antworten (2)
Guillaume
am 15 Mär. 2019
Bearbeitet: Guillaume
am 15 Mär. 2019
It's going to be something like:
excel = actxserver('Excel.Application');
excel.Workbooks.Open('C:\somewhere\someexcelfilewithmacro.xlsx')
excel.Run('NameOfMacro');
excel.Quit; %when done
Of course, it's likely that you need more but with so little details it's unknown what that would be.
"or coding it again in MATLAB language".
There's no translator form VB to matlab. You'll have to write the code yourself.
However, this begs the question: why don't you run the macro directly from excel since it's already working there.
Girish babu P
am 26 Feb. 2020
ExcelApp = actxserver('Excel.Application');
ExcelApp.Visible = 1;
ExcelApp.Workbooks.Open(fullfile(pwd,'\filename.xls'));
ExcelApp.Run('ThisWorkBook.Macro1');
ExcelApp.Quit;
ExcelApp.release;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!