Programming Reference Manual
 
Syntax
 
Word$(text$,first[,last])
 
Description
Returns a String containing a single word or sequence of words between first and last.
 
Words are separated by any nonalphanumeric characters such as spaces, tabs, end-of-lines, and punctuation.
 
If first is greater than the number of words in text$, then a zero-length string is returned.
 
If last is greater than the number of words in text$, then all words from first to the end of the text are returned.
 
 
Parameter
Description
text$
String from which the sequence of words will be extracted.
first
Integer specifing the index of the first word in the sequence to return. If last is not specified, then only that word is returned.
last
Integer specifying the index of the last word in the sequence to return. If last is specified, then all words between first and last will be returned, including all spaces, tabs, and end-of-lines that occur between those words.
See Also
Example
 
Sub Main
‘This example finds the name “Stuart” in a string
‘and then extracts two words from the string.
 
    s$ = “My last name is Williams; “ & _
             “Stuart is my surname.”
 
    c$ = Word$(s$,5,6)
    MsgBox “The extracted name is: “ & c$
End Sub