MATLAB: List of all opened Excel Workbooks in Matlab R2018b

excelMATLAB

Hello,
I am trying to create a list of all opened Excel files (some might be new and not yet saved) using
e = actxGetRunningServer('Excel.Application')
as shown in some examples on this website, but
e.Workbooks.Count
always returns 0 and does not see any open workbooks (I had 2 open when testing this).
I am using version R2018b on Windows 7, and the variable values are:
e: COM.Excel_Application
e.Workbooks.Count: 0
I also tried using
actxserver('Excel.Application')
but it does not help either. Can anyone please tell me what needs to be changed in new version of Matlab to make it work?

Best Answer

Unfortunately for you, this behaviour is not controlled by Matlab but by Excel and your OS. In particular, the behaviour may change depending on the version of Excel (not matlab). You'll have more problems with older versions of excel.
It would be interesting to know what:
e.MergeInstances
returns after you've connected to excel (with actxGetRunningServer) and how many excel processes you've got running (again after you've connected to excel).