I have created a code that will have a couple of messages and then call for the SaveAs window. But, I would like to put a code that if the user cancels, the routine would stop and return to the workbook. So far I got to work if he saves, but even if I cancel it still runs. The code looks something like this. Any ideas?
'
MsgBox ("You are about to Archive Pay Period"), vbExclamation
'
MsgBox ("All records are about to be Archived"), vbOKCancel
'
' HERE I WOULD LIKE TO PUT THE CODE TO BAIL OUT IF CANCEL
'
Application.Dialogs(xlDialogSaveAs).Show
'
'
Sheets("Week 1").Select
Range("B12:J50").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("B12").Select
Sheets("Week 2").Select
Range("B12:H50").Select
Selection.ClearContents
Range("B12").Select
ECT....
'
MsgBox ("You are about to Archive Pay Period"), vbExclamation
'
MsgBox ("All records are about to be Archived"), vbOKCancel
'
' HERE I WOULD LIKE TO PUT THE CODE TO BAIL OUT IF CANCEL
'
Application.Dialogs(xlDialogSaveAs).Show
'
'
Sheets("Week 1").Select
Range("B12:J50").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("B12").Select
Sheets("Week 2").Select
Range("B12:H50").Select
Selection.ClearContents
Range("B12").Select
ECT....