I have codes where I can export multiple queries to one single excel workbook but the problem with my code is that it does not ask me where I would like them to be exported to. Like to my desktop or my documents.
Right now the codes which you see below exports automatically to C Drive.
Does anyone know what I have to add to my codes for it to prompt me where I would like the file to be saved before exporting?
Thanks and any help will be appreciated!
Right now the codes which you see below exports automatically to C Drive.
Does anyone know what I have to add to my codes for it to prompt me where I would like the file to be saved before exporting?
Code:
Public Sub ExportXLS() #If Not CC_Debug Then On Error GoTo ErrProc #Else On Error GoTo ExitProc #End If Const conBASE_PATH As String = "C:\Exports\" Const conEXPORT_OBJ As String = "qryExportMetrics" 'If the Folder C:\Exports does not exist, creatwe it If Dir$(conBASE_PATH, vbDirectory) = "" Then MkDir "C:\Exports" End If DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, conEXPORT_OBJ, _ conBASE_PATH & conEXPORT_OBJ & ".xls", True Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _ TableName:="qryActivity", _ FileName:="C:\Exports\qryExportMetrics.XLS") Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _ TableName:="qryCalled911", _ FileName:="C:\Exports\qryExportMetrics.XLS") Call DoCmd.TransferSpreadsheet(TransferType:=acExport, _ TableName:="qryCalled911Activity", _ FileName:="C:\Exports\qryExportMetrics.XLS") ExitProc: Exit Sub ErrProc: ErrMsg Err, Err.Description, Err.Source Resume ExitProc End Sub
Thanks and any help will be appreciated!
Comment