actxserver "Server creation failed: server execution failed" error when trying to create COM object with EXCEL

149 views (last 30 days)
Why am I getting the following error when I am trying to use the following command in MATLAB command window for Excel to create a user interface to access the data in a Microsoft Excel file by using a COM automation server process?
Excel = actxserver('excel.application')
The same error occurs when I am trying to access any other office application(WORD, POWERPOINT).
Error using feval Server Creation Failed: Server execution failed Error in actxserver (line 89) h=feval(['COM.' convertedProgID], 'server', machinename, interface);

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Aug 2020
There are several reasons why this issue can occur. If you are getting this error, it means MATLAB is not able to connect to Excel due to some issue on your system. It is not a MATLAB error rather a Windows produced error. Please see the following possible reasons and troubleshooting steps for this issue: 
1. The Anti-Virus software (McAfree) may be creating an issue with MS Office. Please try disabling/repairing the anti-virus software and check if it resolves the issue.
2. In order to determine if the issue is with MATLAB or Excel please start Windows Powershell (click start, type 'powershell' and open Windows Powershell app). In power shell, please type this:
$excel= New-Object -ComObject excel.application
(If this produces an error then the issue is not due to MATLAB.)
3. It might also mean a corrupt installation of the MS Office Suite; you can verify if your office installation is corrupt in multiple ways:
  •  Download the attached 'test.vbs' file to your system and then right-click on this file and select "Open with command prompt" option. This should open an Excel session and write the string "Test value" into cell 'A1'.(If it writes the value into excel without any error then their office installation is not corrupt)
  • Please try the following commands in MATLAB command window to check whether other office applications are working fine: 
word = actxserver('Word.Application')
p = actxserver('PowerPoint.Application')
4. If your office installation is corrupt, you can try to repair the Microsoft Office installation by opening the 'Apps and Features' window from the start menu, search for Microsoft Office application and click on it, then click the "Modify" option, and select > Quick Repair.
Then, execute the following command in 'MATLAB' command window:
excel = actxserver('Excel.Application') %this command should not produce any errors if the issue has been resolved.
5. If your Office installation is corrupt and quick repair does not resolve the issue, then you will have to reinstall the MS Office software.
6. Sometimes the issue might be caused due to incorrect 'actxserver' function being called( or being shadowed by a user-defined function with the same name) especially when there are multiple versions of MATLAB on your system, we need to determine if the correct 'actxserver.m' is being used. To do so please enter the following command in your MATLAB command window:
which actxserver
7.    Re-Register the Excel Application: From a command prompt, please navigate to where the Excel.exe file is located and re-register the application. On a 64-bit machine, this is located (by default) under C:\Program Files (x86)\Microsoft Office\Office16
This can be done as shown below:
Type cmd in the START menu and it will show you “Command Prompt” as the best match to your search. Then right click on it and select “Run as administrator”. This should open a command prompt. Now, type the following:
  • CD\
  • And hit ENTER
  • CD C:\Program Files (x86)\Microsoft Office\Office16
  • And hit ENTER
  • EXCEL.EXE –REGSERVER
  • And hit ENTER
8. If none of the above workarounds work out it means that there is an issue with your Windows profile and resetting it should resolve the issue.

More Answers (0)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!