With grd
    For lRow=1 To .Rows
        For lCol=1 To .Cols
            lData=.TextMatrix(lRow,lCol)
        Next
    Next
End With

解决方案 »

  1.   

    mshflexgrid的功能十分强大,你看到TextMatrix属性没??就是定位它单元格值的,text也是。
    dim I as intiger,J as intiger
    for i=0 to Grd.rows-1
       for j=0 to grd.cols-1
           操作excel,打开一个sheet,写入就成了
           Ex.cell(i,j)=grd.textmatrix(i,j)
       next j
    next i
      

  2.   

    coolsky(天心) 不知道是大哥还是大姐:
    找你的方法试了试,运行出错:
    class doesn't support automation or doesn't support expected interface
      

  3.   

    Dim excel_app As Excel.Application
    Dim excel_sheet As Excel.Worksheet
    Set excel_app = CreateObject("Excel.Application")
    excel_app.Workbooks.Add '或者open一个xls文件
    excel_app.Visible = True
    Set excel_sheet = excel_app.Sheets(1) '你写到哪个sheet就用哪个indexdim I as intiger,J as intiger
    for i=0 to Grd.rows-1
       for j=0 to grd.cols-1
          excel_sheet.Cells(i+1, j+1) = grd.textmatrix(i,j) 'Exl里是从1开始
       next j
    next i