Return a string from funtion : Function Return « Language Basics « VBA / Excel / Access / Word






Return a string from funtion

 
Sub cmdReturnValues_Click()
    Dim strInitials As String
    strInitials = ReturnInit("First", "Last")
    MsgBox "Your initials are: " & strInitials
End Sub

Function ReturnInit(strFName As String, strLName As String) As String
    ReturnInit = Left$(strFName, 1) & Left(strLName, 1)
End Function

 








Related examples in the same category

1.return value from user-defined function
2.Specifying the Data Type for a Function's Result
3.Return number from function
4.Passing Parameters and Returning Values
5.Functions That Return an Array
6.Returning a sorted list