Results 1 to 8 of 8

Thread: [RESOLVED] Microsoft Scripting Runtime

  1. #1

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    [RESOLVED] Microsoft Scripting Runtime

    Hi guys,

    I'm trying to use the Split() method in a module and I'm receiving an error informing me the function is undefined. I've inlcuded the Scripting Runtime in the references to the project but it's not made a difference.

    Any idea why this might be happening?

    Thanks
    Last edited by MethadoneBoy; Sep 6th, 2005 at 09:39 AM. Reason: Resolved
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  2. #2
    Lively Member JustinLabenne's Avatar
    Join Date
    Jul 2005
    Location
    Ohio
    Posts
    64

    Re: Microsoft Scripting Runtime

    What version of Excel are you using?
    Justin Labenne
    www.jlxl.net

  3. #3
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Microsoft Scripting Runtime

    I fail to see what the FileSystemObject has to do with this error..

    Split is a VBA function, and this error will be due to either "MISSING" references, unsupported by the version of the VBA application you are using, or failure to disambiguate your code..

    To disambiguate you will need to determine which other reference you are using and proceed the Split() with the reference itself..

    For Example

    VB Code:
    1. Dim MyStr() As String
    2.   MyStr = VBA.Split("Danny|M|King","|")
    3.   Debug.Print MyStr(0)
    4.   Debug.Print MyStr(1)
    5.   Debug.Print MyStr(2)
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  4. #4

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: Microsoft Scripting Runtime

    It's Access, sorry should have specified that - Microsoft Access 97
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  5. #5
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Microsoft Scripting Runtime

    Type VBA followed by the . if this is not in the list then it is not supported..

    As far as I remember Access 97 does not support Split (It's A 2k or above function)
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  6. #6

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: Microsoft Scripting Runtime

    Thanks for the help - you're right, of course. Access 97 doesn't support Split.

    Are there any other ways that a String can be "tokenized" using Access 97?
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

  7. #7
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Microsoft Scripting Runtime

    You would be better off creating your own split function to perform a similar job something like..

    VB Code:
    1. Private Function SplitStr(pString As String, pDelim As String, rArr() As String) As Boolean
    2.   Dim strTemp As String
    3.   Dim i As Long
    4.   On Error GoTo ForcedExit
    5.   SplitStr = False
    6.   ReDim rArr(1 To 1)
    7.   Do While InStr(pString, pDelim) > 0
    8.     strTemp = Left(pString, InStr(pString, pDelim) - 1)
    9.     i = i + 1
    10.     ReDim Preserve rArr(1 To i)
    11.     rArr(i) = strTemp
    12.     pString = Mid(pString, InStr(pString, pDelim) + 1)
    13.   Loop
    14.   'there could be one more left so test and append if so
    15.   If Len(pString) > 0 Then
    16.     i = i + 1
    17.     ReDim Preserve rArr(1 To i)
    18.     rArr(i) = pString
    19.   End If
    20.   SplitStr = True
    21.  
    22. ForcedExit:
    23.   On Error GoTo 0
    24. End Function
    25. Sub test()
    26.   Dim MyStr() As String
    27.   If Not SplitStr("Danny|M|King", "|", MyStr()) Then Exit Sub
    28.   Debug.Print MyStr(1)
    29.   Debug.Print MyStr(2)
    30.   Debug.Print MyStr(3)
    31. End Sub
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  8. #8

    Thread Starter
    Addicted Member MethadoneBoy's Avatar
    Join Date
    Oct 2001
    Location
    Preferably somewhere between Keira Knightley and Diane Kruger but I'm not fussy
    Posts
    180

    Re: Microsoft Scripting Runtime

    Guess it's time I requested a newer version of Access.

    Thanks for all the help, especially that last piece of code!
    "'Oh, hello Mr. Crick! What do you think of Jeffrey Archer?' Clip-clip-clip! Oh, come on! Who are you kidding? You wait til I'm mayor, you'll see how tough I am! Christ almighty...."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width