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