0

I can't understand why it gives an error - an incorrect value. The task is to write a comment in the selected cell by the excel user.I'm trying to get the row and column of the active excel cell - I get an error.Please help me! ` Variant App, Bks, Bk, Shts, Sht, Cll,Active;

MSExcel = Variant::GetActiveObject("Excel.Application");
MyBook = MSBooks.OlePropertyGet("Item",1);
Shts = MyBook.OlePropertyGet("Worksheets");
Sht=Shts.OlePropertyGet("Item",1); //В какую страницу нам вставить значение

Variant row = Sht.OlePropertyGet("Selection").OlePropertyGet("Row");
Variant col =  Sht.OlePropertyGet("ActiveCell").OlePropertyGet("Column");

Cll=Sht.OlePropertyGet("Cells").OlePropertyGet("Item",row,col);
Cll.OleProcedure("AddComment", comment); `

I can't understand why it gives an error - an incorrect value.

Clifford
  • 88,407
  • 13
  • 85
  • 165

0 Answers0