Results 1 to 10 of 10
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    transform com in slash (2000 sr 1)

    Ok, ok, all is ok finally! (Hans i have solved my problem family's. Tks for moral assistence;-))

    I have on a txt file this value : 03.05.2005 and i get this from var_DATACONT = Mid(riga, 45, 10) the result in the cell is 03.05.2005, well is possible to transform the com during the import in slash... and have 03/05/2005
    I dont know is if professional to use SUBSTITUITE comand or you have another idea.
    Tks.
    Sal.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: transform com in slash (2000 sr 1)

    In VBA, you can use the Replace function:

    <code>var_DATACONT = Replace(Mid(riga, 45, 10), ".", "/")</code>

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: transform com in slash (2000 sr 1)

    TKS.

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: transform com in slash (2000 sr 1)

    Still on REPLACE command...
    I get this value with:
    oCELL.Offset(0, 1).Value = Replace(Trim(Sess0.SCREEN.GETSTRING(5, 41, 40)), "- ", "")
    i would want to replace "- " only if this parameter is present in the head of string...
    I think if this value is present in the middle or in the end of string geted is replaced or not?

    In this is case to replace only the first charachter
    from
    - CASH DISPENSER - AMM

    to
    CASH DISPENSER - AMM

    tks.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: transform com in slash (2000 sr 1)

    Try this:

    Dim strValue As String
    strValue = Trim(Sess0.SCREEN.GETSTRING(5, 41, 40))
    ' Test if value begins with a -
    If Left(strValue, 1) = "-" Then
    ' Take the rest of the string
    strValue = Trim(Mid(strValue, 2))
    End If
    oCELL.Offset(0, 1).Value = strValue

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: transform com in slash (2000 sr 1)

    ... OK,
    but after the "-" are present a blank, "- " ... is the same?
    ... and is possible also -EFFETTI (one "-" before the string)

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: transform com in slash (2000 sr 1)

    The line strValue = Trim(Mid(strValue, 2)) will remove the space, so if the value was <code>"- CASH DISPENSER - AMM"</code>, it will be changed to <code>"CASH DISPENSER - AMM"</code>. If you do NOT want to remove the space, change the line to strValue = Mid(strValue, 2)

    What exactly do you mean by "and is possible also -EFFETTI (one "-" before the string)"?

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: transform com in slash (2000 sr 1)

    During the import with:...Trim(Sess0.SCREEN.GETSTRING(5, 41, 40))
    I possible tthe presence of this string "-EFFETTI" it have only one - before the valid string.
    If is possible to mix the old routine in adding this new condition.
    I have think:
    If Left(strValue, 2) = "- " Then or If Left(strValue, 1) = "-" Then...ecccc...

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: transform com in slash (2000 sr 1)

    You should be able to use the code I posted. It will handle both strings beginning with <code>"- Value"</code> and strings beginning with <code>"-Value"</code>.

  10. #10
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: transform com in slash (2000 sr 1)

    Good....
    Iwork, fine naturally!
    Tks my "brother"...

Posting Permissions

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