Example - Mid Function
Sub Main () Dim LWord, Msg, RWord, SpcPos, UsrInp, Phrase ' Declare variables. Msg = "Enter two words separated by a space." UsrInp = InputBox(Msg) ' Get user Input. MsgBox UsrInp SpcPos = InStr(1, UsrInp, " ") ' Find space. If SpcPos Then LWord = Left(UsrInp, SpcPos - 1) ' Get left word. MsgBox "LWord: " & LWord RWord = Right(UsrInp, Len(UsrInp) - SpcPos) ' Get right word. Msg = "The first word you entered is " & LWord Msg = Msg & ". " & "The second word is " & RWord & "." Else Msg = "You didn't enter two words." End If MsgBox Msg ' Display message. Phrase = "Mid Word Test" MidTest = Mid(Phrase, 4, 5) MsgBox "The middle word of the phrase """ & Phrase & """ is: " & chr10 & MidTest End Sub