Hi,


I am using Mac OS X, Version 10.6.8, Office for Mac 2011

The below macro Works in Windows PC and not work in Mac and shows the following error in the below 2 lines

Compile error:
wrong number of arguments or Invalid property assignment

InString = replace(InString, Delims(Ndx) & Delims(Ndx), Delims(Ndx))
  
  InString = replace(InString, Delims(Ndx), Chr(1))
Is there any command equal to the replace command

Function SplitEx(ByVal InString As String, IgnoreDoubleDelmiters As Boolean, _
        ParamArray Delims() As Variant) As String()
    Dim Arr() As String
    Dim Ndx As Long
    Dim N As Long

    If Len(InString) = 0 Then
        SplitEx = Arr
        Exit Function
    End If
    If IgnoreDoubleDelmiters = True Then
        For Ndx = LBound(Delims) To UBound(Delims)
            N = InStr(1, InString, Delims(Ndx) & Delims(Ndx), vbTextCompare)
            Do Until N = 0

                InString = replace(InString, Delims(Ndx) & Delims(Ndx), Delims(Ndx))
                N = InStr(1, InString, Delims(Ndx) & Delims(Ndx), vbTextCompare)
            Loop
        Next Ndx
    End If


    ReDim Arr(1 To Len(InString))
    For Ndx = LBound(Delims) To UBound(Delims)
       InString = replace(InString, Delims(Ndx), Chr(1))
    Next Ndx
    Arr = split(InString, Chr(1))
    SplitEx = Arr
End Function

'This allows mutiple delimiters of different lenghts. For example, to split on |, :: and ,, you would call the function like

Sub AAA()
    Dim S As String
    Dim T() As String
    Dim N As Long
    S = "this||is some::delimited,text"
    T = SplitEx(S, True, "||", "::", ",")
    For N = LBound(T) To UBound(T)
        Debug.Print N, T(N)
    Next N
End Sub
Thanks,
Rakeshh