Error in VBAProject: ActiveX component can't create object

2 Ansichten (letzte 30 Tage)
Nour Tateb
Nour Tateb am 26 Sep. 2016
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 Kommentar
Othmane ELMOUATAMID
Othmane ELMOUATAMID am 12 Nov. 2018
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 ?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by