+ Reply to Thread
Results 1 to 4 of 4

SaveAs Code

  1. #1
    Registered User
    Join Date
    03-23-2007
    Posts
    91

    SaveAs Code

    Is there a way to control the Overwrite box that appears if the file exists?

    Please Login or Register  to view this content.
    I need to be able to control what happens if the user clicks No, or Cancel.

    Thanks

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    If you don't want them to see the "File already exists" dialog at all and simply overwrite the existing then you can add.

    Application.DisplayAlerts = False

    before your SaveAs line

    Be sure to set DisplayAlerts back to True

    If you want to give them options as to what to do if the file already exists then you will probably have to test if Fn exists and use input boxes and \ or messages boxes to let the user assign a new name for the file to be saved as.

    HTH

  3. #3
    Registered User
    Join Date
    03-23-2007
    Posts
    91
    Yes, that's what I need. How can I write a line of code to check if the file exists in that folder?
    Once I get that I can do some If statements and get it to work.

    Thanks

  4. #4
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    You can use the FileExists Method

    you will have to set FileSystemObject and you also need to declare the fill path and filename of the file you wish to check.

    Then check if the result is true or false and take action as desired.

    Please Login or Register  to view this content.
    Check the VBA help for more info.

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1