My application generates a number of Excel spreadsheets.
My code automates naming the spreadsheet, and saving it. Code line:
.Application.Workbooks(sCurrentName).SaveAs (sSavePath & sWorkbookName)
It may happen that the destination folder already contains an older file with the same name.
If this happens, the user is asked if the old file should be replaced with this one.
If "No" is selected, the VB6 code receives an error.
I've worked around this by setting a flag just prior to the above line of code, then in the ErrorHandler, jumping over the error message box.
That works, but it is a cobble. It means that I really am cheating, because I don't know why the error is triggered.
Is there a cleaner way to handle this?
Or should I use my cobble?