Terminating the run in your function can be done by using the keyword - "End"
Sub MySub()
Dim x
x = MyFunc("Test")
MsgBox x
End Sub
x = MyFunc("Test")
MsgBox x
End Sub
Function MyFunc(Arg1) As Long
If Arg1 = "Test" Then
End
Else
MyFunc = 1
End If
End Function
End
Else
MyFunc = 1
End If
End Function
Recommendation :
But using End in this way seems completely wrong. Terminating the run in your function is the wrong way.
You should pass back information via the function(s) and deal with termination in a more appropriate location.
You should pass back information via the function(s) and deal with termination in a more appropriate location.
No comments:
Post a Comment