Hide excel sheet form Excel file

5 ビュー (過去 30 日間)
Santosh Biradar
Santosh Biradar 2022 年 7 月 28 日
コメント済み: Santosh Biradar 2022 年 7 月 28 日
Hello
I have created 3 sheets in same excel. I want to Hide Sheet number 2.
excelFile3 = strcat('SummaryResult','.xlsx');
excelName3 = fullfile(selPath,excelFile3);
Excel = actxserver('Excel.Application');
Workbooks = Excel.Workbooks;
Workbook = Workbooks.Open(excelName3);
Sheets = Excel.ActiveWorkBook.Sheets;
Sheet = get(Sheets,'Item',1);
Sheet.Activate;
......
Script to modify
....
Sheet = get(Sheets,'Item',2);
Sheet.Activate;
......
Script to modify sheet formating
....
Sheet = get(Sheets,'Item',3);
Sheet.Activate;
......
Script to modify sheet formating
.
Workbook.Save;
Excel.Quit;
Excel.delete;
Thank You
I tried to use this link, but could not find the soltion

採用された回答

Jan
Jan 2022 年 7 月 28 日
According to the links you have posted it should work like this:
Sheet = get(Sheets,'Item',2);
Sheet.Visible = 'xlSheetHidden';
You did not show, how you have tried it but only mentioned that you "could not find the solution". Therefore I cannot know, if you have tried the above code already.
  1 件のコメント
Santosh Biradar
Santosh Biradar 2022 年 7 月 28 日
It worked!!!
Thank you so much @Jan.
Thankful for your answer and time.
I was using below script
%%
Sheet = get(Sheets,'Item',2);
Sheet.Activate;
invoke(Sheet,'Delete')
%%

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by