Export to excel

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.
 
K

Ken Snell

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.
 

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

Top