Consulting

Results 1 to 6 of 6

Thread: Solved: separate text using delimiters

  1. #1

    Solved: separate text using delimiters

    I am a newbie to vba!! Pleas tell the function which will split the string based on delimetrs
    eg:
    input:-Dim Sstring, str1,str2,str3,str4,str5, str6 As String
    Sstring=T:\ZS_RD_PKG76\Deliverables\07-01212-001.asm.12


    Output:
    str1=T:
    str2=ZS_RD_PKG76
    str3=Deliverables
    str4=07-01212-001
    str5=asm
    str6=12

    I am running against time.. please

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim Sstring As String
    Dim str As Variant

    Sstring = "T:\ZS_RD_PKG76\Deliverables\07-01212-001.asm.12"
    str = Split(Sstring, "\")
    MsgBox str(0)
    MsgBox str(1)
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Thanks mate!!Thanks a ton!

    but I need to remove the number from file name..

    Is there a funtion to seperate them
    Eg.
    Input:07-01212-001.asm.12

    Output: 07-01212-001.asm

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Dim Sstring As String
    Dim str As Variant

    Sstring = "T:\ZS_RD_PKG76\Deliverables\07-01212-001.asm.12"
    str = Split(Replace(Sstring, ".", "\"), "\")
    MsgBox str(0)
    MsgBox str(1)
    MsgBox str(4)
    MsgBox str(5)
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Thanks a lot mate!!!

    worked like a charm... The following is the modified one which did what i wanted...
    Dim Sstring As String
    Dim str As Variant

    Sstring = "T:\ZS_RD_PKG76\Deliverables\07-01212-001.asm.12"
    str = Split(Replace(Sstring, ".", "\"), "\")
    Range("a1").Value = str(0)
    Range("a2").Value = str(1)
    Range("a3").Value = str(3) & "." & str(4)
    Range("a4").Value = str(5)


    thanks again

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]

    Dim Sstring As String
    Dim str As Variant

    Sstring = "T:\ZS_RD_PKG76\Deliverables\07-01212-001.asm.12"
    str = Split(Replace(Sstring, ".", "\"), "\")
    Range("A1").Resize(UBound(str) - LBound(str) + 1).Value = Application.Transpose(str)
    [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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