How to extract the first word from a string in VBA (Excel)? How to extract the first word from a string in VBA (Excel)? vba vba

How to extract the first word from a string in VBA (Excel)?


Use Split():

Sub TestModule()    Dim test As String    dim frstWrd as string    test = "Machine Head"    frstWrd = split(test," ")(0)    Debug.Print frstWrdEnd Sub