Optional Parameters: Building Flexibility into Functions
Function ReturnInit(ByVal strFName As String, _
Optional ByVal strMI, Optional ByVal strLName)
If IsMissing(strMI) Then
strMI = InputBox("Enter Middle Initial")
End If
If IsMissing(strLName) Then
strLName = InputBox("Enter Last Name")
End If
ReturnInit = strLName & "," & strFName & " " & strMI
End Function
Sub OptionalPara()
msgBox ReturnInit("A", , "B")
End Sub
Related examples in the same category