Need to write code for closing already open excel file in Matlab version 2017a.
조회 수: 4 (최근 30일)
이전 댓글 표시
I have written a matlab code for closing already open excel file. The code is working on my laptop but it is not working on another tower machine. can someone help me with this issue.
Error description is as below
Error using Interface.Microsoft_Excel_16.0_Object_Library.Workbooks/Item
Invoke Error, Dispatch Exception: Invalid index.
file1 = 'C:\Users\ta578\Desktop\Template_Batch_Run.xlsx';
isopen = actxGetRunningServer('Excel.Application');
isopen.WorkBooks.Item(file1).Save;
isopen.WorkBooks.Item(file1).Close;
isopen.delete;
댓글 수: 0
답변 (1개)
Cris LaPierre
2023년 10월 13일
There are some examples that use slightly different syntax here: https://www.mathworks.com/matlabcentral/answers/166071-excel-files-how-to-open-edit-and-then-close-file-without-causing-file-to-become-read-only-in-ma
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!