Why this Error: Object returned error code: 0x800A01A8 is appear?

20 visualizaciones (últimos 30 días)
vinvino
vinvino el 11 de Jul. de 2018
Comentada: vinvino el 25 de Jul. de 2018
Hi all,
While working on the actxserver i am doing some changes in excel for example :
K>> cellrange = ws.Range('C1');
K>> cellrange.Value = 'IamHere';
K>> wb.Save;
Inserted a column and write sting in a cell and saved it, That's perfect.. Then i opened Excel sheet to verify the changes were updated correctly or not. It was update fine. I closed the excel sheet and continued to perform other changes, but i am getting mentioned Error.
K>> ws.Column.Range('D').Insert;
Error: Object returned error code: 0x800A01A8
Why this error is occurring? If we open Excel sheet and again if we want to do change, again do we need to start from step1 (activating the server)?
What is the best way verify the excel sheet at the development stage of the script.
Thanks in Advance!!

Respuesta aceptada

OCDER
OCDER el 11 de Jul. de 2018
My guess is this is caused by the loss of write access to your file. To prevent both Excel and Matlab from trying to edit the same file at the same time, one program would have to give up write access. Seems like Matlab loses write access when the file is opened with Excel.
If this is true, then the fix would be to not open the file with Excel midway of a Matlab process.
  1 comentario
vinvino
vinvino el 25 de Jul. de 2018
yes you are right.. So whenever we reopen or work with the same file we need to terminate the excel application process from the windows as well using below command i able to do it.
system('taskkill /F /IM EXCEL.EXE');

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by