Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    3

    Unanswered: Bypass 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!
    TD

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Well..... You could break one of the Access Developer 10 Commandments "Thou shalt not use the Sendkeys command"

    Just send an "Enter"

    I'm sure there's a better way though!
    Inspiration Through Fermentation

  3. #3
    Join Date
    Sep 2003
    Posts
    3
    I don't think that sendkeys would work in this instance. The timing is all off. The mod would send the enter key WAY before the box even popped up.

    The only way around this I could think of would be to put in some kind of delay but I would prefer a much cleaner alternative.

    Thanks for your help.

    TD

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    You can write some code in the modules section and use the RunCode() action in your macro.

    Something like
    Dim fs as New FileSystemObject
    If fs.FileExists("PathToYourFileHere") Then
    fs.DeleteFile("PathToYourFileHere")
    End If
    set fs = Nthing

    You will need a reference to Microsoft Scripting Runtime
    All code ADO/ADOX unless otherwise specified.
    Mike.

  5. #5
    Join Date
    Sep 2003
    Posts
    3
    Thanks for you help guys ...

    It seems that Send Keys actually worked out for me this time ...
    Although I realize I should probably be slapped on the wrist for using it ... I had to push the red button that says do not push.

    TD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •