Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bypassing File Overwrite Prompt

Status
Not open for further replies.

davisto01

MIS
Jul 11, 2003
21
US
I'm running a macro that saves a report as an excel spreadsheet. This macro is called by the task manager daily. (it's automated because I can't physically be there to run it myself)

Whenever the macro gets to the command that translates the report to an .xls a dialog pops up asking me if I would like to overwrite the existing file. Of course I would like to overwrite the existing file.

Please tell me that there is a macro command or a work around that will allow me to bypass this. I can't be there to press {OK} nor can I be there to delete the existing file from the directory everyday.

Thanks
TD

 
Hi TD,

I'm not sure about suppressing the msgbox but you could first delete the file via code before running your macro, it is one line of code:

Kill "C:\YourFileName"
.......then run your macro



Regards,
gkprogrammer
 
That will work, but in case the file you want to Kill is not always going to be there, you need to check that too. Use Dir (FileName) first, that will return "" is it's not there.
Simon Rouse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top