Results 1 to 7 of 7

code to skip excel save as overwrite prompt

This is a discussion on code to skip excel save as overwrite prompt within the Excel Questions forums, part of the Question Forums category; I have a code that uses savas to back up a file. first it saves it then it does a ...

  1. #1
    Board Regular
    Join Date
    Jun 2003
    Posts
    207

    Default code to skip excel save as overwrite prompt

    I have a code that uses savas to back up a file. first it saves it then it does a save as to back it up. however i dont want a new file every time its saved. i just want to save as a certain name and write over it each time. is there a way to avoid the prompt that says a file with that name already exsists do you wish to overwrite it?

  2. #2
    MrExcel MVP
    Moderator
    Smitty's Avatar
    Join Date
    May 2003
    Location
    Crested Butte, CO
    Posts
    27,104

    Default Re: code to skip excel save as overwrite prompt

    Application.DisplayAlerts = False
    ' Your save code
    Application.DiplayAlerts = True

    Should take care of it for you.

    HTH,

    Smitty

  3. #3
    Board Regular
    Join Date
    Jun 2003
    Posts
    207

    Default Re: code to skip excel save as overwrite prompt

    Here is the code I put that into:

    ActiveWorkbook.Save
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs FileName:=Range("B299")
    Application.DiplayAlerts = True

    And this is what I get:

    Run time error '438'
    Object doesnt support this property or method

    It them hilights the line:

    Application.DiplayAlerts = True


    Any suggestions?

  4. #4
    MrExcel MVP
    Moderator
    Smitty's Avatar
    Join Date
    May 2003
    Location
    Crested Butte, CO
    Posts
    27,104

    Default Re: code to skip excel save as overwrite prompt

    Yup...My bad spelling is to blame...

    Application.DiplayAlerts = True

    Should be:

    Application.DisplayAlerts = True

  5. #5
    Board Regular
    Join Date
    Jun 2003
    Posts
    207

    Default Re: code to skip excel save as overwrite prompt

    Thanks

  6. #6
    New Member
    Join Date
    Jul 2007
    Posts
    3

    Default

    Thanks for keeping this posted. Four years later it helped me!!

  7. #7
    New Member
    Join Date
    Oct 2008
    Location
    Cardiff, Wales
    Posts
    47

    Default Re: code to skip excel save as overwrite prompt

    sorry, mis-cliked and can't delete the reply

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com