MATLAB: How to open an excel file in read-only with actxserver

actxserverexcelread-only

Hi,
I am using actxserver to read some data from various Excel files. The code works fine, but when it encounters a file that is currently opened by another user, it causes an error:
Error using Interface.000208D7_0000_0000_C000_000000000046/Item
Error: Call was rejected by callee.
When I open the same file manually in Excel, I get a dialog option to open it in read-only mode. Since I do not want to change or save the file, that is exactly what I need. Is there a way to choose this option from Matlab and avoid the error?
Thank you.

Best Answer