フィルターのクリア

Reading tooltip comments from an excel sheet

2 ビュー (過去 30 日間)
Daniel Schmidt
Daniel Schmidt 2018 年 5 月 22 日
編集済み: Daniel Schmidt 2018 年 5 月 25 日
Hello everyone,
I have an Excel file with multiple sheets, that I open in MATLAB via an active X server. I then go through the sheets via a for-loop to extract the data:
[file,path] = uigetfile('*.xlsm');
Excel = actxserver ('Excel.Application');
Excel.Workbooks.Open([path,file]);
Workbook = Excel.ActiveWorkbook;
Worksheets = Workbook.sheets;
numberOfSourceSheets = Worksheets.Count;
for i = 1:numberOfSourceSheets
sheetIndex = i;
Worksheets.Item(sheetIndex).Activate;
caExcelCellInfo = get(Excel.ActiveSheet);
MyData{i,1} = caExcelCellInfo.UsedRange.Value;
end
So far, my code ignores the tooltip-comments that appear when hovering over a cell. Using
caExcelCellInfo.Comments.Count
I can actually count them so they must be there somewhere, but I haven't found a way to actually read them. Can you guys help me?

採用された回答

Sangeetha Jayaprakash
Sangeetha Jayaprakash 2018 年 5 月 24 日
Getting each cell, and then using the Comment.Text property as follows, worked for me:
comments = caExcelCellInfo.Comments
cellitem = comments.Item(1)%for the first cell- need to iterate using a loop here for each cell
cellitem .Text
I hope that helps.
  1 件のコメント
Daniel Schmidt
Daniel Schmidt 2018 年 5 月 25 日
編集済み: Daniel Schmidt 2018 年 5 月 25 日
It works, thank you very much. :)

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by