Need to write code for closing already open excel file in Matlab version 2017a.

5 ビュー (過去 30 日間)
Sneha Patil
Sneha Patil 2023 年 10 月 13 日
回答済み: Cris LaPierre 2023 年 10 月 13 日
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;

回答 (1 件)

Cris LaPierre
Cris LaPierre 2023 年 10 月 13 日

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by