I would like to grab every character in a combo box until the first space. How would I do that, left, mid, trim???
Printable View
I would like to grab every character in a combo box until the first space. How would I do that, left, mid, trim???
Try this:
Enjoy! :rolleyes:Code:Dim sTextUpToSpace As String
Dim lSpacePos As Long
sTextUpToSpace = MyComboBox.Text
lSpacePos = InStr(sTextUpToSpace, " ")
If lSpacePos Then sTextUpToSpace = Left(sTextUpToSpace, lSpacePos - 1)
' Now use sTextUpToSpace.
Code:Dim Str As String
Str = Left$(Trim$(Combo1.Text), InStr(1, Combo1.Text, " "))
Print Str
In VB6
Dim Str As Variant
Str = Combo1.Text
Str = Split(Str, " ")
MsgBox Str(o)