Example - Left Function

  1. Sub Main ()

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

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

      UsrInp = InputBox(Msg)' Get user input.

      print UsrInp

      SpcPos = InStr(1, UsrInp, " ")' Find space.

      If SpcPos Then

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

        print "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 "

        Msg = "The first word you entered is <" & LWord & ">"

        Msg = Msg & RWord & "."

      Else

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

      End If

      MsgBox Msg' Display message.

      MidTest = Mid("Mid Word Test", 4, 5)

      Print MidTest

    End Sub