Export query and save as .xls?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
Right now my macro tha can save my query as a .csv file. I would like it to
save as .xls. I am new to programing so please help me. Here is what my macro
or "RunCode" is:

-----------------------------------------------------------------------
Function QueryName()
Dim path As String

path = AppPath & "QueryName.csv"
On Error Resume Next
Kill path
On Error GoTo 0

DoCmd.TransferText acExportDelim, , "QueryName", path, True
If Not NoWarning Then
MsgBox "The QueryName file has been created in " & path
End If
End Function
---------------------------------------------------------


I imagine that I have to change the "DoCmd.TransferText acExportDelim" line
to something else. Can someone tell me what to use?

Thank You in advance.
 
Back
Top