Public Sub rs2xls(rs As Object)
'将子窗体记录复制到XLS中
On Error GoTo errit
'set rs = Me.子窗体.Form.Recordset
Dim oExcel As Object
Dim oBook As Object
Dim i As Integer
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add()
rs.MoveFirst
For i = 0 To rs.Fields.Count - 1
oBook.Worksheets(1).Cells(1, i + 1).Value = rs.Fields(i).Name
Next