Error using xlswrite (line 226)

Hi All,
I'm trying to use xlswrite but I received this message:
"Error using xlswrite (line 226) Invoke Error, Dispatch Exception: Source: Microsoft Excel Description: Microsoft Excel cannot access the file 'C:\Program FilesC:\Program Files\MATLAB\R2017a\bin\9DDE4000"
What is very strange is that instead xlsread work for the same file. I have no idea of reason. My Office release is 2019 and is activated.
Thank you in advance. Any suggests is very appreciated.
Emanuele

4 Commenti

If that does not work, go into Office and disable any add-ons you might have, especially Foxit
Emanuele
Emanuele il 27 Ott 2019
Thanks Walter for your suggest.
I deactivated the only .com component (WinZip) that was active.
I have try but don't work.
dpb
dpb il 27 Ott 2019
'C:\Program FilesC:\Program Files\MATLAB\R2017a\bin\9DDE4000"
looks funky -- the "C:\Program Files" is duplicated. I'd first suspect your code building the file name has a problem.
Secondly, use Task Manager and make sure there are no zombie copies of Excel still hanging around that didn't close successfully after an earlier failed attempt. I've had that happen innumerable times while messing around w/ COM and having made a typo that caused an internal failure--the cleanup code apparently can't always fix up everything.
Alternatively, closing and restarting MATLAB will get rid of any such instances as well, but until the filename issue is resolved I think you'll continue to have issues...at least that's what the crystal ball is reading.
Emanuele
Emanuele il 27 Ott 2019
Thanks All
I solved.
For dpb, yes you are right but it's only an error in copy error message.
The problem was that xlswrite don't find the right directory of file.
so I specify in this way
filename = 'C:\Users\Pc\Documents\MATLAB\TEST.xlsx';
and all work fine.
What made me go crazy is that instead xlsread work without specify directory. I don't know the reason of this different behavior but now work.
Thanks again.
Emanuele

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Files and Folders in Centro assistenza e File Exchange

Prodotti

Release

R2017a

Richiesto:

il 27 Ott 2019

Commentato:

il 27 Ott 2019

Community Treasure Hunt

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

Start Hunting!

Translated by