Issues in Running VBA macros programmatically from Matlab
Hello,
When I try to open my VBA macro enabled excel directly and run the macro within excel, it works fine. However, when I try to do the same operation using Matlab script, it shoots these error messages. Does anyone has any idea?
% Test Script VBA Code access and run
ExcelApp = actxserver(‘Excel.Application’); % Create object
ExcelApp.Visible = 1; % Show window (optional).
macrobook = ExcelApp.Workbooks.Open(fullfile(‘C:Pro’,’Test.xlsm’)); % Open file
retVal = ExcelApp.Run(‘Macro1’); % Run Macro1
I have checked my macro settings in excel and they are all enabled:
I have also attached a simple macro enabled file example.Hello,
When I try to open my VBA macro enabled excel directly and run the macro within excel, it works fine. However, when I try to do the same operation using Matlab script, it shoots these error messages. Does anyone has any idea?
% Test Script VBA Code access and run
ExcelApp = actxserver(‘Excel.Application’); % Create object
ExcelApp.Visible = 1; % Show window (optional).
macrobook = ExcelApp.Workbooks.Open(fullfile(‘C:Pro’,’Test.xlsm’)); % Open file
retVal = ExcelApp.Run(‘Macro1’); % Run Macro1
I have checked my macro settings in excel and they are all enabled:
I have also attached a simple macro enabled file example. Hello,
When I try to open my VBA macro enabled excel directly and run the macro within excel, it works fine. However, when I try to do the same operation using Matlab script, it shoots these error messages. Does anyone has any idea?
% Test Script VBA Code access and run
ExcelApp = actxserver(‘Excel.Application’); % Create object
ExcelApp.Visible = 1; % Show window (optional).
macrobook = ExcelApp.Workbooks.Open(fullfile(‘C:Pro’,’Test.xlsm’)); % Open file
retVal = ExcelApp.Run(‘Macro1’); % Run Macro1
I have checked my macro settings in excel and they are all enabled:
I have also attached a simple macro enabled file example. excel, macros MATLAB Answers — New Questions