Dim xSheet As New Excel.Worksheet
Dim xlsApp As New Excel.Application
Dim i As Integer
xlsApp.Workbooks.Add
Set xSheet = xlsApp.Sheets("sheet1")
For i = 0 To rs.Fields.Count - 1
xSheet.Cells(1, i + 1) = rs(i).Name '填写标题
Next
xSheet.Range("A2").CopyFromRecordset rs '复制内容
Set xSheet = Nothing
Set xlsApp = Nothing