Outputto action to automatically replace an excel file

P

Phil Ferguson

When using the Outputto action I am promoted to confirm replacement of an
excel file. How can I use the macro to automatically replce without being
prompted?
 
P

Phil Ferguson

I have done this but am still being prompted with the question to replace the
existing excel file.
 
C

Chris Reveille

Here is some code I got from Ken Snell a while back.

Set Warnings does not trap this Window message. You'll need
to use VBA code to avoid this message box. That code will
"Kill" the existing file and then put the new file in its
place -- all without warnings:

If Dir("C:\MyFolder\Filename.txt") <> "" Then Kill
"C:\MyFolder\Filename.txt"
DoCmd.OutputTo (.. rest of arguments)

Chris
 
Top