aravindhan_31
Well-known Member
- Joined
- Apr 11, 2006
- Messages
- 672
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi, I wanted to export the result of the query to an excel & I have the below vba code which exports as an excel file, but I am not able to open the excel file it says file extension not valid
code taken from http://www.mrexcel.com/forum/micros...export-access-select-queries-excel-files.html
can someone helpe me pelase
code taken from http://www.mrexcel.com/forum/micros...export-access-select-queries-excel-files.html
Code:
Private Sub ExportExcel()
Dim i As Integer
Dim myQueryName As String
Dim myExportFileName As String
myQueryName = "Result1"
myExportFileName = "C:\Users\aravindhan.jayaraman\Desktop\ACAT" & myQueryName & ".xlsb"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, myQueryName, myExportFileName, True
End Sub
can someone helpe me pelase