Export to excel

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

I have the following command:

DoCmd.TransferSpreadsheet acExport, , "xlquery", "C:\My
Documents\ExportFile.xls", True, ""

When the file is created in excel the worksheet name
defaults to xlquery which is the name of the query in the
command.

My question is how do I name the worksheet in excel what I
want and not have it default to the name of the query?

Thank you for your help.
 
Answer: you can't do it in the TransferSpreadsheet command.

What you would need to do is to open the EXCEL file via Automation (after
you run the TransferSpreadsheet command) and then use code to change the
name of the worksheet directly.
 
Back
Top