VBA- Access Excel automation-export query Version: 2003

Hi...I don't know anything about VBA but I believe I am close to being able to output my Access query to Excel and manipulate the worksheet. In the code below I have been able to open a workbook and enter the word test in cell a1. I have tried several different ways to export a query called query2 to worksheet 2 in the workbook with no luck. Does anyone have any idea on how to do this? I think it has something to do with opening a recordset which I have in the code but where do I go from there?

Thanks for your help!

Private Sub Command33_Click()
Dim cnn As ADODB.Connection

Dim rstGetRecordSet As Recordset

Dim objXL As Object
Dim strWhat As String, boolXL As Boolean
Dim objActiveWkb As Object
Set cnn = CurrentProject.Connection

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If

objXL.Application.workbooks.Add

Set objActiveWkb = objXL.Application.ActiveWorkBook

With objActiveWkb
.Worksheets(1).Cells(1, 1) = "test"
strWhat = .Worksheets(1).Cells(1, 1).Value

End With
objXL.Visible = True

Set objActiveWkb = Nothing: Set objXL = Nothing

End Sub
[1322 byte] By [impius] at [2007-11-20 10:51:50]