Hello,
I have the below code with a simple save as command for my macro. The issue I run into is, if the file already exist and I choose "No" or "cancel" in the dialog box the code returns a runtime error since it doesn't know what to do next. I haven't had any luck with any methods of continuing my code using resume. I don't want to use a false command on the current dialog box since I want the user aware the file already exist. My goal is when this save as box pops up and the user choose no or cancel for it to skip to the next macro.
Thanks!
I have the below code with a simple save as command for my macro. The issue I run into is, if the file already exist and I choose "No" or "cancel" in the dialog box the code returns a runtime error since it doesn't know what to do next. I haven't had any luck with any methods of continuing my code using resume. I don't want to use a false command on the current dialog box since I want the user aware the file already exist. My goal is when this save as box pops up and the user choose no or cancel for it to skip to the next macro.
Code:
Sub SaveFile()
Dim dtDate As Date
dtDate = Date
Dim strFile As String
strFile = "FilePath\FileName" & Format(dtDate, "mmddyyyy") & ".xlsm"
ActiveWorkbook.SaveAs Filename:=strFile, FileFormat _
:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
Application.Run ("Macro")
Thanks!