Example:

Sub Main ()

Dim LWord, Msg, RWord, SpcPos, UsrInp ' Declare variables.

Msg = "Enter two words separated by a space."

UsrInp = InputBox(Msg) ' Get user Input.

MsgBox "You typed " & UsrInp

SpcPos = InStr(1, UsrInp, " ") ' Findspace.

 

If SpcPos Then

LWord= Left(UsrInp, SpcPos - 1) ' Get left word.

RWord = Right(UsrInp, Len(UsrInp) - SpcPos) 'Get right word.

Msg1 = "The first word you entered is *" & LWord & "*."

Msg2 = " The second word is *" & RWord & "*."

Msg = Msg1 & Msg2

Else

Msg = "You didn't enter two words."

End If

MsgBox Msg ' Display message.

MidTest = Mid(UsrInp, 4, 7)

MsgBox "Result of Mid statement is: " & MidTest

End Sub