How to write xls comment nodes (red corners) from Matlab ?
Show older comments
I use the standard xlswrite function to write data into xls from Matlab :
xlswrite(name_xls,xls_data,1,'A1');
I would like to write comments (the pop-up that comes when hovering over the cells) simultaneously :
xlswritewithcomments(name_xls,xls_data,xls_comments,1,'A1');
Anybody knows if there is a function I did not find or some way to do this ?
Working with ActiveX is really not the most interesting part of Matlab, so if someone has a working code or pieces of code, I am interested.
Anyway, here is one of my attempts for comments :
xls macro :
Range("A1").Select
Range("A1").AddComment
Range("A1").Comment.Visible = False
Range("A1").Comment.Text Text:="Arnaud LASTNAME:" & Chr(10) & "qsd"
Matlab :
>> Select(Range(Excel,'A1'));
>> Excel.selection.AddComment;
>> set(Excel.selection.Comment,'Visible',false);
>> set(Excel.selection.Comment,'Text','My comment');
Error using Interface.00024427_0000_0000_C000_000000000046/set
Error: method or property not found
And Text IS defined :
>> Excel.selection.Comment.Text
ans =
Thanks Arnaud LASTNAME:
Accepted Answer
More Answers (1)
Iain
on 27 Aug 2014
0 votes
There is a solution. Its called "write your own function".
Step 1: If you open up the code for xlswrite, you'll be able to see how matlab interacts with excel.
Step 2: Open excel and record a macro of you putting a comment into a cell.
Step 3: Read that macro's code.
Step 4: Adapt the code behind "xlswrite" to do what you need it to. - You'll likely need to use a fair amount of trial and error to get it right. "Excel.Show" might be of use :P
2 Comments
Iain
on 27 Aug 2014
set(Excel.selection.Comment,'Visible',false);
set(Excel.selection.Comment,'Text','My comment');
Just a guess, but
Excel.selection.Comment.Visible = 1; % or
Excel.selection.Comment.Show
Might work...
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!