Norma Posy
asked on
Declining a "Save As" produces an error
My application generates a number of Excel spreadsheets.
My code automates naming the spreadsheet, and saving it. Code line:
.Application.Workbooks(sCu rrentName) .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?
My code automates naming the spreadsheet, and saving it. Code line:
.Application.Workbooks(sCu
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER