Mega Code Archive

 
Categories / VisualBasic Script / String Functions
 

Use MsgBox(), InStr(), Left(), Right() and Len() to read the first name and last name

Sub AboutUser()     Dim fullName As String     Dim firstName As String     Dim lastName As String     Dim space As Integer     fullName = InputBox("Enter first and last name:")     space = InStr(fullName, " ")     firstName = Left(fullName, space - 1)     lastName = Right(fullName, Len(fullName) - space)     Debug.Print lastName & ", " & firstName End Sub