Error in VBAProject: ActiveX component can't create object

조회 수: 5 (최근 30일)
Nour Tateb
Nour Tateb 2016년 9월 26일
댓글: Othmane ELMOUATAMID 2018년 11월 12일
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
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 CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by