I am trying using Excel as a COM Automation Server. When I try to execute a macro from one of my Add-ins:
Excel = actxserver('Excel.Application');Workbooks = get(Excel,'Workbooks');fWorkbook = invoke(Workbooks,'Add');fWorksheet = get(fWorkbook,'Activesheet');fRange = fWorksheet.Range('A1:B2');fRange.Value{1,1} = 'name';fRange.Value{2,1} = 'foo';fRange.Value{1,2} = 'amount';fRange.Value{2,2} = 100;Excel.Run('myMacro');
I receive the following error:
ERROR: % ??? Invoke Error, Dispatch Exception:
% Source: Microsoft Office Excel
% Description: The macro 'myMacro' cannot be found.
% Help File: D:\Applications\MSOffice\OFFICE11\1033\xlmain11.chm
% Help Context ID: 0
Best Answer