Dim appExcel As Object
Dim wkbWorkBook As Object
Dim wksSheet As Object
' creates Excel application
Set appExcel = CreateObject("Excel.Application")
' opens workbook for output
Set wkbWorkBook = appExcel.Workbooks.Open("e:\aa\Book1.xlsx")
' get reference to sheet for output
Set wksSheet = wkbWorkBook.Worksheets("RawData")
' for each record, output all fields in the record
Dim rs As Recordset
Dim row As Integer: row = 1
Dim col As Integer: col = 1
Set rs = Me.Form.Recordset
If rs.RecordCount > 0 Then
rs.MoveFirst
Do While Not rs.EOF
Dim fld As Field
For Each fld In Me.Recordset.Fields
wksSheet.Cells(row, col) = fld
col = col + 1
Next fld
rs.MoveNext
col = 1
row = row + 1
Loop
End If
' save and quit
wkbWorkBook.Save
appExcel.Quit
Set wksSheet = Nothing
Set wkbWorkBook = Nothing
Set appExcel = Nothing