Error using actxserver(line 90). Server creation failed. Invalid ProgID 'Excel.Application'. with MAC and Matlab R2017b

I am able to run a custom matlab function that importing data from excel to matlab on my window pc, however, I am having the below error on my new MAC pc.
Error using actxserver (line 90)
Server creation failed. Invalid ProgID 'Excel.Application'.
My excel version on MAC is not a click-to-run which is a common issue with windows.
From my invastigation the issue is related to Component Object Model (COM) server but I cannot find a solution.
I am using Excel Version 16.50, Matlab R2017b
Any help solving it would be highly appreciated.

Answers (1)

https://www.mathworks.com/help/matlab/ref/actxserver.html says that actxserver() is only available for Windows. The Mac version of Excel does not have the interface compiled in to it.

11 Comments

This is very strange! This mean that matlab cannot interact with excel on IOs which is very unfortunate. It should be a way to overcome this as I strongly doubt that Mathworks runs only on Win and not any other operating systems
As far as I know, there is no Mac compatible ActiveX capability. ActiveX is a Windows-only technology. Microsoft is dropping ActiveX for better security. Active-X was never ported to the Mac. Since it doesn't exist on the Mac, and no one (not Apple, Microsoft or anyone else) has invested in Active-X to make it cross-platform, you must use either standard legacy controls, or invest what it takes to port Active-X to the Mac.Herb Gu _ MSFT May 4 '20 at 9:03
Based on important industry trends, NetDocuments will terminate support for Internet Explorer and ActiveX, effective August 31, 2020 (the “Effective Date”).
You should be getting rid of ActiveX even for Windows; using, for example, .NET instead https://www.mathworks.com/help/matlab/matlab_external/work-with-microsoft-excel-spreadsheets-using-net.html
What can you do on Mac or Linux? Mostly you use OpenDocuments or OfficeLibre, as those provide methods to invoke their functionality from other programs.
This is how I used the ActiveX in order to connect with excel
try
% use existing Excel session
Excel = actxGetRunningServer('Excel.Application') ;
catch
% Start Excel as ActiveX server process.
Excel = actxserver('Excel.Application');
end
Do you have any recommendation how to incorporate .NET instead?
I tried the following but I am getting an error
NET.addAssembly('microsoft.office.interop.excel');
app = Microsoft.Office.Interop.Excel.ApplicationClass;
books = app.Workbooks;
newWB = Add(books);
app.Visible = true;
Error using NET.addAssembly
Attempt to execute SCRIPT addAssembly as a function:
/Applications/MATLAB_R2017b.app/toolbox/matlab/winfun/NET/+NET/addAssembly.m
You cannot use .NET or ActiveX on Mac or Linux.
My point about .NET was that you should be working towards getting rid of ActiveX even on Windows.
You might be able to use AppleScript to control Excel on MacOS; http://preserve.mactech.com/articles/mactech/Vol.23/23.02/2302AppleScript/index.html
However, I would have to wonder whether you would gain anything compared to using readtable() or readcell() .
The readtable() fuction works properly but I must use my own functions which my core infrustracture is based on.
?? That appears go be implying that the only acceptable solution for you would be to have activexserver() work on Mac? Even using NET (if, hypothetically, it worked on Mac) would not be using your core infrastructure, since your core infrastructure is activexserver() ?
If that is not what you mean, then perhaps you could clarify how readtable() is incompatible ?
I need to find a way to connect matlab with excel so I can use my own classes.
I can read excel file via various functions like ( xlsread or readtable) but this not what I am looking for. Please the code lines below to understand better how I manipulate excel file :
try
% use existing Excel session
Excel = actxGetRunningServer('Excel.Application') ;
catch
% Start Excel as ActiveX server process.
Excel = actxserver('Excel.Application');
end
Excel.Application.DesplayAletrts=false;
Excel.workbooks.Open([TgtWorkBookPath TgtWorkBookName],true,[],[],[],[],false);
WorkBook=Excel.WorkBooks.Add;
WorkBook.SaveAs(strcat(TgtWorkBookPath, TgtWorkBookName),51);
TgtRange=ActiveSheet.get('Range',TgtTopLeftCell.Address, TgtBottomRightCell.Address);
TgtRange.Cells.ClearContents;
TgtRange.Value=zz;
It would be theoretically possible for someone to write a C++ or Java or even MATLAB set of classes such that the interface would stay the same other than the initial actxserver() call -- though such an interface might not be able to support multiple processes working "live" with the same file.
However, I have my doubts that anyone will write such an interface.
If you have a specific need to use that interface, then I think it is unrealistic that you are going to be able to proceed.
I think it would be more realistic if you were to rewrite in terms of calls to OpenOffice or Office Libré DLLs, and use those on all three platforms.
Hi I am doing my MAster Thesis ,
For me as a Window user with all softwares (x64 bit), I can see the progID in the registry of my system but then also MATLAB COM object is not detecting. What could be the possible cause for this?
P.S. I unistalled and reinstalled Ansys MAxwell too but still no clue which software (Ansys EDT or MATLAB) I should look into for debugging. Also, using actxserver(progid) is the only way for me as I want to do parametrisation and optimisation.
Thanks a lot in advance!!
Are you asking about connecting to Ansys student desktop, or are you asking about connecting other software to MATLAB using MATLAB as the server to process requests on behalf of other software?
I want to call Ansys student Electronics desktop 2022.2 (x64) from MATLAB environment using MATLAB command actxserver(progid).
Few intial lines of code:
iMaxwell=actxserver('Ansoft.ElectronicsDesktop'); % Also tried various combinations of prog id
Desktop=invoke(iMaxwell,'GetAppDesktop');
Project =Desktop.NewProject();
Error:
Server creation failed. Invalid ProgID 'Ansoft.ElectronicsDesktop'

Sign in to comment.

Asked:

on 22 Jul 2021

Community Treasure Hunt

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

Start Hunting!