custom file name on export to excel



I have the following code to export to spreadsheet. This is working fine
for me. The only thing I want is to have a custom file name to save my
spreadsheet as. This would leave to the user to simply select where he/she
wants to save the file. Below, stdocname is the name of the query that I
want to be exporting.

I would like my file name to be something like this:

"Bundles Query Search as of Now()", where Now() is today's date using the

Is this possible?

Private Sub Command36_Click()
On Error GoTo Err_Command36_Click

Dim stDocName As String

stDocName = "Bundles Query Search"
DoCmd.OutputTo acOutputQuery, stDocName, acSpreadsheetTypeExcel9

Exit Sub

MsgBox Err.Description
Resume Exit_Command36_Click

End Sub


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads