Bypassing Overwrite Prompt

  • 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 for the tip.

    I'm not actually finding Application.DisplayAlerts to be a VB command.

    I'm using Access 97.

    One thing I tried in the meantime is to use the SendKeys to send "enter" thus overwriting the document ...

    I know, I know, that's a very bad thing to do but I was sinking in quicksand. I'm still open to suggestions though.


  • You're right. It works just fine for Excel VBA (I just checked it too) but I'm calling the spreadsheet from an Access Module.
    That means that at some point Access will try to create the file named ErrorReport.xls but see that it already exists in the directory. After I get past this Overwrite screen, Access will open Excel and then my ErrorReport will open up.

    Is there a similar command in Access 97 VBA? I've been looking all over.

    After running a few trials I have discovered that sendkeys does not actually work.

  • Hi Derk,

    I'm still pulling what's left of my hair out over this issue. Setting Warnings = to false in access doesn't stop the overwrite screen from coming up. Stops all of the other annoying warnings though.
    Any other words of wisdom are welcome

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!