Is there a way to control the Overwrite box that appears if the file exists?
I need to be able to control what happens if the user clicks No, or Cancel.![]()
Please Login or Register to view this content.
Thanks
Is there a way to control the Overwrite box that appears if the file exists?
I need to be able to control what happens if the user clicks No, or Cancel.![]()
Please Login or Register to view this content.
Thanks
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
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
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.
Check the VBA help for more info.![]()
Please Login or Register to view this content.
HTH
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks