Hi,
I know I can turn off the alerts by using
However, in a particular juncture in the macro I don't want to turn off the alerts, if people are overwriting the file they should be prompted, if they select YES then the macro should continue (and it does), however if they select no it prompts the DEBUGGER.Application.DisplayAlerts = False Application.DisplayAlerts = True
I want a Msg Box to pop up if they select no that says: YOUR PLAN WAS NOT SUBMITTED.
How can I do that? Thanks for any help!!!
Hello gophins,
Here is an example.
If Answer = "No" Then MsgBox "Your Plan was Not Submitted." 'Add code here for what you want to do next End If
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
But what if the prompt is not mine, it is excel's, so when I say
I'm not really responding to a msg box that I created. So when Excel prompts: A filne named X already exists... Do you want to replace it? If I select yes, the macro continues (which is what I want), if people select No or Cancel, I want them to be prompted with the Msg Box "Your Plan was Not Submitted." and then Exit Sub.If Answer = "No" Then MsgBox "Your Plan was Not Submitted."
I don't know if I'm explaining it right...
Thanks
Hello gophins,
You don't need to respond to this dialog, you need to prevent it from being displayed. You're getting this message because of an error that can be avoided. You only need to test if the file or folder exists before you attempt to create it.
If Dir("J:\MyFile.xls") <> "" Then 'Code here to deal with prexisting file Else 'Code to create new file End If
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks