I am wondering if anyone can help me figure out what I should be doing in order for me to export multiple queries to one single excel file.
Currently, I have this EXPORT button in my main form where when I click on it, it ask me to save the file/export to my computer. The exported file thus consists of only ONE queries but I wanted more queries to be exported in different worksheet under the same excel file.
So far my codes are:
Public Sub ExportXLS()
#If Not CC_Debug Then
On Error GoTo ErrProc
Const cQuery As String = "qryExportMetrics"
Dim fc As FileChooser
Dim strFileName As String
Set fc = New FileChooser
fc.DialogTitle = "Select file to save"
fc.OpenTitle = "Save"
fc.Filter = "Excel Files (*.xls)"
strFileName = Nz(fc.SaveFile, "")
Set fc = Nothing
' If user selected nothing or canceled, quit
If Len(strFileName) = 0 Then
' If file already exists, delete it
ElseIf Len(Dir(strFileName)) > 0 Then
ErrMsg Err, Err.Description, Err.Source
Thanks in advance