Does .save work correctly for Excel object in Excel 2010?

조회 수: 1 (최근 30일)
ES
ES 2014년 6월 27일
댓글: ES 2014년 6월 30일
Hi, I used to run certain matlab scripts for formatting excel sheets. I use activex for accesing Excel(Office 2003) in those scripts. Now I have migrated to Excel 2010, and now the Excel Object's .save method does not seem to work. can anybody help me?
% Create COM object for the current Sheet.
objExcel=actxserver('excel.application');
objExcelW=objExcel.Workbooks;
ExcelFilePath = pwd;
objExcelF=objExcelW.Open(fullfile(ExcelFilePath, ExcelFileName));
objExcelS=objExcelF.ActiveSheet;
....
some formatting, data write operations etc using the sheet object objExcelS
....
% Delete the COM Object.
objExcelF.Save;
objExcelF.Close;
objExcel.Quit;
objExcel.delete;
The script hangs at objExcelF.Save; :(
  댓글 수: 1
Gnaneswar Nadh satapathi
Gnaneswar Nadh satapathi 2014년 6월 27일
use: save('fimename.xlsx',yourvariable) it needs only Excel to be installed in your system. it might be 2003/2010

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 6월 27일
It works fine for me. Try
objExcel.ActiveWorkbook.Save();
  댓글 수: 1
ES
ES 2014년 6월 30일
Hi Image Analyst, thanks for your reply. When the amount of changes is less, the .save method works. But when the amount of changes made in the Excel after creating the COM is more, the .save runs for eternity. In Excel 2003, .save worked well irrespective of the amount changes in the Excel File. Thanks a lot for your support. Have a good day!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by