thenone
asked on
Error in Function
With this function im getting an error
Public Function Get1Words(sInput As String) As String
Dim sTmp() As String
sTmp() = Split(sInput, " ", 2)
sTmp(UBound(sTmp)) = vbNullString <<<sub script is out of range
Get1Words = Join(sTmp, " ")
End Function
Public Function Get1Words(sInput As String) As String
Dim sTmp() As String
sTmp() = Split(sInput, " ", 2)
sTmp(UBound(sTmp)) = vbNullString <<<sub script is out of range
Get1Words = Join(sTmp, " ")
End Function
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That wouldn't make any difference to this code...
ASKER
well thats weird I am getting an error sub script is out of range
Create a new project and paste the code above...do you still get an error?
ASKER
no i don't that is really weird.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok found the problem the input string was null.
ASKER