If the user selects OK or cancel, then quit. This works.
If the user enters something, then continue
the process. This does not work. If I enter info, it wants to quit. It should not.
I have tried numerous ways with no complete success.
If the user enters something, then continue
the process. This does not work. If I enter info, it wants to quit. It should not.
I have tried numerous ways with no complete success.
Code:
Static Sub MonthAndYear() 'remember to >>Public ReportMonth As String
Application.StatusBar = "Enter Month and Year"
Application.DisplayAlerts = False
ReportMonth = ""
ReportMonth = Application.InputBox("Enter the FULL name of the month to " _
& "be processed followed by the FOUR DIGIT year. " _
& "If you want to close the workbook and exit, select OK or CANCEL ", _
"Month and Year", Default:=ReportMonth, Type:=2)
On Error GoTo continue
'On Error GoTo cancelled:
If Len(LTrim(ReportMonth)) = 0 Or ReportMonth = "" Then
MsgBox "You have chosen to close Commissions Based on Sales"
Workbooks("CommissionsBySalesQBTestFile.xls").Close
'Else: GoTo cancelled
End If
'cancelled:
MsgBox "You have chosen to close Commissions Based on Sales"
Workbooks("CommissionsBySalesQBTestFile.xls").Close
continue:
Application.DisplayAlerts = True
Application.StatusBar = False
End Sub