Error with xlswrite (error 0x800A03EC)

1 回表示 (過去 30 日間)
alex
alex 2019 年 9 月 19 日
編集済み: Adam Danz 2019 年 9 月 23 日
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 件のコメント
alex
alex 2019 年 9 月 19 日
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 2019 年 9 月 19 日
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!

サインインしてコメントする。

回答 (2 件)

CAM
CAM 2019 年 9 月 19 日
Try xlsprotect from File Exchange.
It has worked well for me in the past.

Adam Danz
Adam Danz 2019 年 9 月 19 日
編集済み: Adam Danz 2019 年 9 月 23 日
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.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by