I have an requirement to read Comments present in cells of spreadhseet from Excel.
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an requirement to read Comments present in cells of spreadhseet from Excel.
Hi,
I have a requirement to read Comments from Excel Cells.With TestComplete I tried using Sys.OleObject("Excel.Application") and navigated to repsective sheet.
Later i used the below command:-
Excel.Worksheets(4).Range("B1").Comment.Text;
I get an error stating Object doesnt support this property or method.
Can anyone help me with a solution to read the comment of the cell.
Thanks
Sudit
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't think you want to use "Range". Thats for capturing a number of cells.
Change range to "Cell(x,y)" instead.
When you say comments, is this just standard text contained in a cell or is it like a tooltip type popout comment?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Text" is a method, not a property. Use
Excel.Worksheets(4).Range("B1").Comment.Text();
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Colin,
I did try with Cell(x,y) but it didnt work out.
Also as you rightly guessed Comment is like a tooltip popup comment.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Think your answer might be a combination of both answers.
For an individual cell, you should probably use "Cell" rather than "Range" but what @joseph_michaud says about your syntax is probably right. I've never tried to retrieve comment type text from Excel before so not sure ....
(I guess "Range" will work if you give it a range of a single cell, but suspect "Cell" would make more sense)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The answer provided by joseph_michaud worked for me. Have you tried it yet?
