In Excel-VBA, I am saving a file using the following code:
fullFileName = Application.GetSaveAsFilename(...)
ActiveWorkbook.SaveAs fullFileName
This works fine until the name chosen already exists. The message box then prompts: “Should the file be replaced?”. I want to answer No, and return to the previous message box and chose another name.
Instead, clicking No interrupts the macro and produces an error.
How could I solve this?
(The web is full of examples showing how to bypass this message box using Application.DisplayAlerts=False and save anyway. This is not what I want!)
This is usually what I use…
FOLLOWUP
Do you mean like this?