VB 数据库 导入EXCEL WORD和导出问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 00:20:36
我用VB写了一个小工具。。。 带数据库功能。 我想把有得 内容 导出到EXCEL和 WORD 或者把 EXCEL 和 WORD 导入到 数据库中。。 请问怎么写代码?? 麻烦说详细一点啊。。。

Private Sub Command3_Click()
On Error Resume Next
Dim irow, icol, count, i As Integer
Dim irowcount, icolcount As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim bl As Boolean
Dim key As Integer
Dim RsUserTemp As Recordset
Dim RsOrderTemp As Recordset
Dim a, b
Dim aa As String
aa = Trim(Now)
Set xlApp = CreateObject("excel.application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
'If rs.RecordCount < 1 Then
'MsgBox ("Error 没有记录")
'Exit Sub
'End If
irowcount = rs.RecordCount
icolcount = 18
count = 0
rs.MoveFirst
For icol = 0 To 2
'xlSheet.Cells(1, 1).Value = "查询数据" '加标头;
Next icol
xlSheet.Cells(1, 1).Value = "时间" '加标头;
xlSheet.Cells(1, 2).Value = "药开度" '加标头;
xlSheet.Cells(