Your code is not "Automation" code. Automation is the use of code to
directly interact with another Office program.
What you would need is code similar to the following (air code provided as
an example):
Public Sub ExportToExcel()
Dim lngRow As Long
Dim xlx As Object, xlwb As Object, xlws As Object
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
lngRow = 0
Set xlx = CreateObject("Excel.Application")
Set xlwb = xlx.Workbooks.Open("C:\Filename.xls")
Set xlws = xlwb.Worksheets("SheetName")
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TableOrQueryName", dbOpenDynaset)
If rst.BOF = False And rst.EOF = False Then
rst.MoveFirst
Do While rst.EOF = False
xlws.Range("A11").Offset(lngRow, 0).Value = rst!FieldName
rst.MoveNext
lngRow = lngRow + 1
Loop
End If
xlwb.Save
xlwb.Close False
Set xlwb = Nothing
xlx.Quit
Set xlx = Nothing
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
End Sub