Author: Jonas Bilinkevicius
How to put the content of a TStringGrid into an Excel range
Answer:
1 { ... }2 var3 ArrV: Variant;
4 Cell: Range;
5 { ... }6 7 ArrV := VarArrayCreate([0, NumRows, 0, NumCols], varOleStr);
8 for Row := 0 to NumRows do9 for Col := 0 to NumCols do10 ArrV[Row, Col] := StringGrid1.Cells[Col, Row];
11 Cell := Excel.ActiveCell;
12 WS.Range[Cell, Cell.Offset[NumRows, NumCols]].Value := ArrV;
13 { ... }