Hi,
I have a problem using a macro in Excel. I have used the SaveAs method of the Workbook class to save a workbook. If a file by the same name (as I generate) already exists, excel asks the user whether they would like to overwrite or not.
ActiveWorkbook.SaveAs Filename:=fileSaveName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
If the user clicks 'no' or 'cancel' , VB generates a 1004 run-time error.
however, 1004 seems to be a generic error. So, when I am trapping errors, and a 1004 error is generated, how can I distinguish between a user clicking on 'no' or 'cancel' and a genuine save error?
Thanks,
Simon.
I have a problem using a macro in Excel. I have used the SaveAs method of the Workbook class to save a workbook. If a file by the same name (as I generate) already exists, excel asks the user whether they would like to overwrite or not.
ActiveWorkbook.SaveAs Filename:=fileSaveName, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
If the user clicks 'no' or 'cancel' , VB generates a 1004 run-time error.
however, 1004 seems to be a generic error. So, when I am trapping errors, and a 1004 error is generated, how can I distinguish between a user clicking on 'no' or 'cancel' and a genuine save error?
Thanks,
Simon.