Spliting Text

PeteJM

Registered User.
Local time
Today, 15:09
Joined
Oct 31, 2004
Messages
28
Hi, Would it be possible to get the first word from a sentance.

For example

Peter James would Return Peter.
John Michael would Return John etc.

The first word could range from 1 to 50 characters.

Regards

Pete
 
Last edited:
You can use the InStr() function to locate the first space in the string. Try this from the debug (immediate) window.

MyStr = "The quick brown fox"
NewStr = Left(MyStr, instr(MyStr, " ") - 1)
? NewStr
The

HTH - Bob
 
Hi, Thank you very much that worked perfectly.

Kind Regards

Pete
 

Users who are viewing this thread

Back
Top Bottom