Name Stamp export to Excel

L

learning_codes

Hi,

Is there a way to make the data export to excel like "Bob.xls". Right
now, I try to test and still give me the name of the query.

Here is the line of the code:

DoCmd.SendObject acQuery, "Query", "MicrosoftExcelBiff8 *.xls)",
"[email protected]", "", "", "Subject", "", False

I received my email with attachment: Query.xls

Is there a way for me to capture from CurrentUserName (strUserID =
Me.CurrentUserName)?

I want to see Bob.xls instead of Query.xls.

Your help would be much appreciated.

Thanks
 
K

Ken Snell \(MVP\)

Use DoCmd.TransferSpreadsheet instead of DoCmd.SendObject. You can specify
the name of the EXCEL file with DoCmd.TransferSpreadsheet.
 
Top