MATLAB: Does the ACTXSERVER function in MATLAB open a new instance of Excel in MATLAB 7.0 (R14)

actxserverapplicationautomationexcelinstanceMATLABnew

When I execute the following commands:
a = actxserver('Excel.Application');
a new instance of Excel is opened. I would like the ACTXSERVER function to use the instance of Excel that is already open.

Best Answer

This enhancement has been incorporated in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
This feature has been added to MATLAB 7.4 (R2007a).
Starting with this version , you can get the get the handle to a running instance of an Automation server such as an Excel Application in MATLAB, by using the following function:
h = actxGetRunningServer('Excel.Application');
This gets a reference to a running instance of the Excel Application, where h is the handle to the server object's default interface. For more information execute the command
doc actxGetRunningServer
If you are using a previous version, read the following:
The ability for the ACTXSERVER function to use the current instance of Excel is not available in older versions of MATLAB prior to MATLAB 7.4 (R2007a).
To work around this issue, start Excel as an Automation server. The ACTXSERVER function can then use the instance of Excel that is already open. To do this, execute the following commands at the Windows Command Prompt:
excel /regserver
excel -automation
Before executing these commands, be sure that the Microsoft Excel executable excel.exe is on the system path.
After you have started Excel as an Automation server, the ACTXSERVER command uses the current instance of Excel.
a = actxserver('Excel.Application');