Accommodating for Missing Parameters in Your Code
Function ReturnInit3(ByVal strFName As String,Optional ByVal strMI, Optional ByVal strLName)
Dim strResult As String
If IsMissing(strMI) And IsMissing(strLName) Then
ReturnInit3 = strFName
ElseIf IsMissing(strMI) Then
ReturnInit3 = strLName & ", " & strFName
ElseIf IsMissing(strLName) Then
ReturnInit3 = strFName & " " & strMI
Else
ReturnInit3 = strLName & "," & strFName & " " & strMI
End If
End Function
Sub MissingPara()
msgBox ReturnInit3("A", , "B")
End Sub
Related examples in the same category