Sub NamedParameter()
msgBox ReturnInit3("Bill", , "Gates")
msgBox ReturnInit3(strFName:="Bill", strLName:="Gates")
msgBox ReturnInit3(strLName:="Gates", strFName:="Bill")
End Sub
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