Export to excel file in Access

  • Thread starter Thread starter Ivan
  • Start date Start date
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
 
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"
 
Back
Top