我也想知道啊!!
Function FillExcel()
'//第三次更改
Dim strsource, strdestination As String
strdestination = App.Path & "\硫化产量统计.xlt"
Set mobjexcel = New Excel.Application
Set mobjexcel = CreateObject("Excel.Application")
mobjexcel.Visible = True
Set mobjworkbook = mobjexcel.Workbooks.Open(strdestination)
Set xlsheet = mobjworkbook.Worksheets(1)
i = 0
With mobjworkbook.ActiveSheet
While Not rs.EOF
.Cells(4 + i, 1).Value = rs!日期
.Cells(4 + i, 2).Value = rs!机台号
.Cells(4 + i, 3).Value = rs!姓名
.Cells(4 + i, 4).Value = rs!硫化品代码
.Cells(4 + i, 5).Value = rs!col
.Cells(4 + i, 6).Value = "条"
.Cells(4 + i, 7).Value = rs!班次
i = i + 1
rs.MoveNext
Wend
End With
rs.Close
sqlcon.Close
xlsheet.Visible = True
mobjexcel.DisplayAlerts = False
Set mobjexcel = Nothing
End Function