Why my split function doesn't work

  • Thread starter Thread starter joyo
  • Start date Start date
J

joyo

I don't know why my split function doesn't work. See the code below.

Dim str As String
Dim substr As String
Dim mArray() As String
Dim mArrayUpper As Integer
Dim mCounter As Integer

str = "This\is\a\test"
mArray = Split(str, "\") 'this line got error message
mArrayUpper = UBound(mArray)
For mCounter = 0 To mArrayUpper
substr = mArray(mCounter)
Next mCounter

I just got the error message, "Run-time error 13, Type mismatch"

Why?

Thanks

joyo
 
Hi Joyo,
I ran your code and recieved no error. Try running
the code in a new Sub or Function and see if it works. If
so, then the mismatch is coming from some field or
variable in the original environment:)

The Easy Day
 
Back
Top