Hello,
I know this is probably an easy question to answer but I have not been able to find it yet.
I'm trying to export a query to excel but I would like to have the Save As window come up so that the user can choose where they are saving it and for the file name I would like to use the resault of a string set by a combo box.
Here's what I have so far and it works to save the excel file and use the combo box selection as a name.
I know this is probably an easy question to answer but I have not been able to find it yet.
I'm trying to export a query to excel but I would like to have the Save As window come up so that the user can choose where they are saving it and for the file name I would like to use the resault of a string set by a combo box.
Here's what I have so far and it works to save the excel file and use the combo box selection as a name.
Thank youFunction QueryExportToExcel()
On Error GoTo Error_Handler
Dim stQueryToExport
stQueryToExport = [Forms]!frmAvailQueries.cboAvailableQueries
DoCmd.OutputTo acOutputQuery, stQueryToExport, acFormatXLS, "C:\" & stQueryToExport & ".xls", , , , acExportQualityPrint
Error_Handler:
If err.Number = 94 Then
MsgBox "Please remember to select something from the drop down list first."
Exit Function
End If
End Function