|
Private Sub Command0_Click()
Dim rs As DAO.Recordset
Dim Filnum As Long
Dim Recnum As Long
Dim xlapp As Object
Set rs = Me.导出数据.Form.Recordset
Set xlapp = CreateObject("excel.application")
xlapp.Visible = True
xlapp.Workbooks.Open ("C:\Documents and Settings\bus\桌面\ACCESS示例\ACCESS示例\shili.xls")
Dim sheet As Object
Set sheet = xlapp.Sheets("sheet1")
rs.MoveFirst
Recnum = 1
Do Until rs.EOF
For Filnum = 0 To rs.Fields.Count - 1
sheet.cells(Recnum, Filnum + 1) = rs.Fields(Filnum)
Next
Recnum = Recnum + 1
rs.MoveNext
Loop
'sheet.cells(3, 3) = "12345678"
End Sub |
|