Error with xlswrite (error 0x800A03EC)

5 vues (au cours des 30 derniers jours)
alex
alex le 19 Sep 2019
Modifié(e) : Adam Danz le 23 Sep 2019
Hello everyone!
Unfortunatelly, i have a problem while using xlswrite.
i read other tasks from people who had the same error,however it's not the same situation.
I mean that when i write this
xlswrite(excelfile1,5,2,'O17')
it works fine!
However when i write this i get this error
xlswrite(excelfile2,5,2,'O17')
Error using xlswrite (line 219)
Excel returned: Error: Object returned error code:
0x800A03EC.
the difference between the two commands is the file. The first file is a common xls file. The second file is an xls file that has locked the sheets. However the cell O17 is unlocked!
Anyway, i unlock the sheets and it continues to give me the same error.
Any idea what to do?
I use matalab R2014a
  2 commentaires
alex
alex le 19 Sep 2019
I realised that i can write in at the first sheet only, but not in any other sheet.
If i put any other sheet as first i can write at it.
any ideas?
alex
alex le 19 Sep 2019
SOLUTION FOUND
In the excel file the first sheet is a normal sheet with data.
the second third and fourth sheet are charts
and the rest of the sheets are normal sheets with data.
Somewhere in my code i use Activex server
e = actxserver('Excel.Application');
ewb = e.Workbooks.Open(excelfile);
ewb.Worksheets.Item(2).Name
the Item(2).Name is not the 2nd sheet because it is a chart ,but it is the 5th sheet.
But,when i tried to
xlswrite(excelfile2,5,2,'O17')
the xlswrite function obviously considers the second sheet(which is a chart i remind) as number 2 sheet. and it tried to xlswrite there and as a result i got the error i mentioned.
Anyway,thanks for the help again!

Connectez-vous pour commenter.

Réponses (2)

CAM
CAM le 19 Sep 2019
Try xlsprotect from File Exchange.
It has worked well for me in the past.

Adam Danz
Adam Danz le 19 Sep 2019
Modifié(e) : Adam Danz le 23 Sep 2019
This is an excel error code - not a problem with matlab.
If you search for that error code you may find some help. For example,
This error code has also appeared in the forum before and many of those questions have been answered which may give you leads.

Produits


Version

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by