'********************************************************************

'*

'* Function GetFirstLetters

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2007-01-26

'* Modified: 2007-01-26

'*

'* Purpose: Returns an array containing the first letter of each word

'*            in a string.

'*

'* Input:  strAny = Any string containing words separated by spaces.

'*

'* Output:  Returns an array containing the first letter of each word

'*            in a string.

'*

'* Notes: This is useful for getting initials from a full name.

'********************************************************************

Function GetFirstLetters(ByVal strAny)

  'Version: 1.0 2007-01-26

  Dim aryTemp, x

  'Remove any leading and ending spaces.

  strAny = Trim(strAny)

  If InStr(1, strAny, " ") > 1 Then

    aryTemp = Split(strAny, " ")

    For x = 0 to UBound(aryTemp)

      If Len(aryTemp(x)) >= 1 Then

        aryTemp(x) = Left(aryTemp(x), 1)

      End If 'Len(aryTemp(x)) >= 1

    Next 'x

  End If 'InStr(1, strAny, " ") > 1

  GetFirstLetters = aryTemp

End Function 'GetFirstLetters

Article ID: 395, Created On: 9/25/2011, Modified: 9/25/2011