怎样把查询的数据 导入Excel 表中的第一个数据在第8行的第二列
Dim myexcel As New Excel.Application '定义一个新的Excel对象Dim mybook As New Excel.Workbook '定义一个新的BOOK对象
Dim mysheet As New Excel.Worksheet '定义一个新的SHEET对象
Set mybook = myexcel.Workbooks.Add '添加一个新的BOOK
Set mysheet = mybook.Worksheets.Add '添加一个新的SHEET
Set mysheet = mybook.Worksheets(1) '设置活动工作表
Dim i As Integer, j As Integer, h As Integer, k As Integer
h = Adodc1.Recordset.RecordCount
k = Adodc1.Recordset.Fields.Count
For i = 8 To h
For j = 3 To k
mysheet.Cells(i, j - 1) = Adodc1.Recordset.Fields.Item(j - 1).Value
Next j
Adodc1.Recordset.MoveNext
Next i
myexcel.Visible = True
myexcel.Visible = True
这段代码我想把查询的数据 导入到Excel 表中的第一个数据在第8行的第二列,以此排列,
可是如果导入的数据条数是查询数据的条数-7
请问如何改呢
我将 For i = 8 To h
改成 For i = 8 To h+8
可是导入不出数据,请各位大侠帮帮我看看 --------------------编程问答-------------------- http://download.csdn.net/detail/veron_04/2341786 --------------------编程问答-------------------- For i = 1 To h
For j = 3 To k
mysheet.Cells(i+7, j - 1) = Adodc1.Recordset.Fields.Item(j - 1).Value
Next j
Adodc1.Recordset.MoveNext
Next i
myexcel.Visible = True
补充:VB , 数据库(包含打印,安装,报表)