|
x = 9
'写入数据到相关的单元格,
TableA.MoveFirst '移动指针到第一条记录
Do Until TableA.EOF = True
xlsheet.Cells(x, 1) = TableA.recordcount
xlsheet.Cells(x, 2) = TableA!个人编号
xlsheet.Cells(x, 3) = TableA!姓名
xlsheet.Cells(x, 4) = TableA!性别
'xlsheet.Cells(x, 5) = TableA!民族
xlsheet.Cells(x, 6) = Format(TableA!出生日期, "yyyy-mm")
xlsheet.Cells(x, 7) = TableA.recordcount
xlsheet.Cells(x, 8) = TableA!家庭住址
xlsheet.Cells(x, 9) = TableA!学籍号
xlsheet.Cells(x, 10) = TableA!现在校名称
xlsheet.Cells(x, 11) = TableA!现在校年级
xlsheet.Cells(x, 12) = TableA!校外文化程度
xlsheet.Cells(x, 13) = TableA!离校时就读年级
'xlsheet.Cells(x, 14) = TableA!
xlsheet.Cells(x, 15) = TableA!三残类别
xlsheet.Cells(x, 16) = TableA!其他残疾
xlsheet.Cells(x, 17) = TableA!是否失能
xlsheet.Cells(x, 18) = TableA!在外就读地点
TableA.MoveNext
x = x + 1
Loop
你上面的代码用下面的一句就可以了.
xlsheet.Range("A9").CopyFromRecordset TableA |
|