Save file prompt

chadzilla

New member
Local time
Today, 15:10
Joined
Oct 18, 2007
Messages
2
Hello all,
I have a macro that exports a table to an excel file using the OutputTo option in the macro builder. The macro works fine, but every time I run it, I get a prompt that the file already exists, and it asks if I want to over write the existing file. Is there a way to get rid of the prompt and just automatically over write the file?
Thanks for any help.
 
Hi,

This is a snip of code pinched from a previous thread posted by Bob Larsen.

If Dir(strFileNameAndPath)<> "" Then
Kill(strFileNameAndPath)
DoCmd.OutputTo...
Else
DoCmd.OutputTo...
End If

Do a search of this forum for "KILL" and you will find other examples.

Garry
 
or you could set the warnings off but make sure you turn them back on again

search help for DoCMD.Setwarnings
 
I dont think that "docmd.setwarnings" will switch off the warning if thay are being generated outside of Access as I think is the case here.

Garry
 
Thanks for the info. I'll be trying this today, and I will let you guys know.
 
I agree with Garry, I think this particular warning is being generated by Windows itself and not Access. If this is the case then SetWarnings will not stop this warning from happening. boblarson has a good example of how to stop this warning.
 

Users who are viewing this thread

Back
Top Bottom