Error in VBAProject: ActiveX component can't create object
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am currently trying to call a matlab function from excel using an excel addin made in matlab. However, i run into trouble at the moment where i call the function in excel and i get this error message "Error in VBAProject: ActiveX component can't create object"
I am trying first to run the example in the MATLAB documentation i.e making an excel addin for the mymagic function defined as below:
function y = mmmagic(x)
% MYMAGIC Magic square of size x.
% Y = MYMAGIC(X) returns a magic square of size x.
% This file is used as an example for the MATLAB Compiler product.
% Copyright 2001-2007 The MathWorks, Inc.
y = magic(x)
which i stored in a M-file: mymagic.m
now, i go to the MATLAB compiler and create a new project for an excel-addin and name it mymagic. i rename the class (class1) as mymagic and i add my M-file mymagic.m then i build my project. Then i go to my distrib directory to collect mymagic.xla which i slide into my excel spreadsheet. Now i add the dll into the registry by executing this line regsvr32 "C:\Users\Desktop\mmyagic\distrib\mymagic_1_0.dll" in the Run app
Finally, when i run mymagic function in excel i get the error message "Error in VBAProject: ActiveX component can't create object". Could someone help with this please? Many thanks
1 个评论
Othmane ELMOUATAMID
2018-11-12
Hello Nour Tateb,
Is MCRinstaller/MATLAB already installed in the computer where you're trying to use your mymagic.xla ?
Also, did you add the path of your add-in to the list of "Trusted Locations" in MS-Excel ?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!