The following MATLAB code runs the macro test
saved as a module in the excel file test.xlsx
:
filename = 'test.xlsx';
Excel = actxserver('Excel.Application');
workbook = Excel.Workbooks.Open(filename);
Excel.Application.Run("test");
Is there a way to run the same macro test
, when it is saved in an external Basic Macro file, functions.bas
, or as a text file, or as a string in memory, without turning the office file into a macro enable document?
Function test()
MsgBox "Hello World"
End Function