Option Explicit
' Create a command button and three text boxes
' to run the following code
Private Sub Command1_Click()
Dim inputOK As Boolean
Call checkInputs(inputOK)
If inputOK Then
MsgBox "continue"
Else
MsgBox "oops"
End If
End Sub
Private Sub checkInputs(ByRef okInput As Boolean)
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = Val(Text1)
b = Val(Text2)
c = Val(Text3)
okInput = False
If a <= 0 Then
MsgBox "bad a input"
ElseIf b <= 0 Then
MsgBox "bad b input"
ElseIf c <= 0 Then
MsgBox "bad c input"
Else
okInput = True
End If
End Sub