Hi.
What can i do to prevent this from happen?
errors:Code:parse = Split(lstNowWarn.List(l), ":")
numbers = parse(0)
names = parse(1)
parse(0) = <Subscript out of range>
parse(1) = <Subscript out of range>
Big Thanks,
naitsabes
Printable View
Hi.
What can i do to prevent this from happen?
errors:Code:parse = Split(lstNowWarn.List(l), ":")
numbers = parse(0)
names = parse(1)
parse(0) = <Subscript out of range>
parse(1) = <Subscript out of range>
Big Thanks,
naitsabes
Check how many splits were created:VB Code:
Dim Splits As Long Splits = UBound(Parse) - LBound(Parse) + 1 If Splits > 0 Then Numbers = Parse(0) If Splits > 1 Then Names = Parse(1)
bpd is correct. FYI, if the string you are trying to split is an empty string (""), the Split function will set the UBound of the resulting array to -1.
I would do it similar to this:
VB Code:
If lstNowWarn.List(l) <> "" then parse = Split(lstNowWarn.List(l), ":") numbers = parse(0) ' you get at least this If UBound(parse) > 0 Then names = parse(1) End If End If
thanks guys, i try this.
naitsabes