Link to home
Start Free TrialLog in
Avatar of thenone
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


SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenone
thenone

ASKER

Could it be that I am putting it in a module
That wouldn't make any difference to this code...
Avatar of thenone

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?
Avatar of thenone

ASKER

no i don't that is really weird.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenone

ASKER

ok found the problem the input string was null.