Export to excel file in Access

I

Ivan

Hello,

to export the select query data to excel file in VBA code you can use
DoCmd.OutputTo or DoCmd.TransferSpreadShet method. Ok, you can use both
types as a macro action too.

In my applications I'm using both versions. In one of my programs I have to
transfer the data every night to the same excel file. Because of the fact
that the file of the fixed name has been existing from the previous night
Access program always notices me about that and asks me to overwrite the
file. I don't find any argument (parameter) in either of methods to demand
default overwriting. I want to avoid to click all the times, so I want to
automate the overwriting. Is there really the only solution to delete the
excel file first and only then export the query data to the file, which will
be new created? Or did I overlook any fact?

Ivan
 
K

Ken Snell MVP

TransferSpreadsheet will not ask if you want to overwrite the file; it will
just do it.

Otherwise, in VBA code, you can delete a file by using the Kill command:

Kill "C:\MyFolder\MyFile.xls"
 

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