VBA/Excel/Access/Word/String Functions/InStr
Версия от 16:33, 26 мая 2010; (обсуждение)
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