'没其它的办法,只能用循环的方式读出数据,这和ListView控件差不多。不过可以先将数据读入数组,再通过数组写入Excel,毕竟Excel的VBA是最忌讳逐单元格操作的。
Dim arr(), lRow, lCol
Dim i, j
lRow = MSFlexGrid1.Rows
lCol = MSFlexGrid1.Cols
ReDim arr(1 To lRow, 1 To lCol)
For i = 0 To lRow - 1
For j = 0 To lCol - 1
arr(i + 1, j + 1) = MSFlexGrid1.TextMatrix(i, j)
Next
Next
xlsheet1.Range("a1").Resize(lRow, lCol) = arr