I have a button that exports a query to an excel. The issue is the name of the query is in the file name. Is there a way the user has to enter a file name?
My code is:
My code is:
Code:
Private Sub BtnExport_Click()
On Error GoTo Err_Handler
DoCmd.Requery (ListboxExport_qry)
DoCmd.OutputTo acOutputQuery, "ListboxExport_qry", acFormatXLSX, sFilename, True
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox "The exported excel was not saved."
Resume Exit_Handler
End Sub