Forum Discussion

sudit's avatar
sudit
New Contributor
9 years ago
Solved

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

 

5 Replies

  • 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? 

    • sudit's avatar
      sudit
      New Contributor

      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.

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        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)