Adding error code to Excel macro
Posted on 2007-10-18
How do I put error code in this macro. If the file already exsists and I select "NO" do not overright I get an error where to macro should just terminate.
Dim Response As Integer
ThisFile = Range("k19").Value
ActiveWorkbook.SaveAs Filename:=ThisFile, FileFormat:=52
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Quit Program?", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
' The no button was selected.