Home All Groups Group Topic Archive Search About
Author
2 Mar 2007 7:26 PM
Anna
Hi: Can any one please tell me how to i change 00032 value in the
string without disturbing the original size of the string?

the second curly bracket upto the starting character "O"is always same
in the string

20070302
HD000000000{000000000{00032ODSS                                HCS1

newvalue=65
so it will be
20070302
HD000000000{000000000{00065ODSS                                HCS1

Thanks.

Author
2 Mar 2007 7:47 PM
mayayana
See the Mid *statement*. The Mid function
gets a string within a string, but if you turn
it around you replace a string within a string:

Mid(s, 26, 2) = "65"

Show quoteHide quote
> Hi: Can any one please tell me how to i change 00032 value in the
> string without disturbing the original size of the string?
>
> the second curly bracket upto the starting character "O"is always same
> in the string
>
> 20070302
> HD000000000{000000000{00032ODSS                                HCS1
>
> newvalue=65
> so it will be
> 20070302
> HD000000000{000000000{00065ODSS                                HCS1
>
> Thanks.
>
Author
2 Mar 2007 7:53 PM
Rob
Show quote Hide quote
On 2 Mar 2007 11:26:16 -0800, "Anna" <colleen1***@gmail.com> wrote:

>Hi: Can any one please tell me how to i change 00032 value in the
>string without disturbing the original size of the string?
>
>the second curly bracket upto the starting character "O"is always same
>in the string
>
>20070302
>HD000000000{000000000{00032ODSS                                HCS1
>
>newvalue=65
>so it will be
>20070302
>HD000000000{000000000{00065ODSS                                HCS1
>
>Thanks.

  Something like this?

  Dim s As String

  s = "HD000000000{000000000{00032ODSS"

  Mid$(s, 26, 2) = "65"

  Debug.Print s
Author
2 Mar 2007 9:33 PM
Henning
Show quote Hide quote
"Rob" <r**@notvalid.com> skrev i meddelandet
news:200hu219fptq2dl1319d7of41i65183fjg@4ax.com...
> On 2 Mar 2007 11:26:16 -0800, "Anna" <colleen1***@gmail.com> wrote:
>
> >Hi: Can any one please tell me how to i change 00032 value in the
> >string without disturbing the original size of the string?
> >
> >the second curly bracket upto the starting character "O"is always same
> >in the string
> >
> >20070302
> >HD000000000{000000000{00032ODSS                                HCS1
> >
> >newvalue=65
> >so it will be
> >20070302
> >HD000000000{000000000{00065ODSS                                HCS1
> >
> >Thanks.
>
>   Something like this?
>
>   Dim s As String
>
>   s = "HD000000000{000000000{00032ODSS"
>
>   Mid$(s, 26, 2) = "65"
>
>   Debug.Print s
>
Or Mid$(s, 23, 5) = Right$("00000" & Format(newvalue),5)

/Henning
Author
2 Mar 2007 8:06 PM
Rick Rothstein (MVP - VB)
> Hi: Can any one please tell me how to i change 00032 value in the
> string without disturbing the original size of the string?
>
> the second curly bracket upto the starting character "O"is always same
> in the string
>
> 20070302
> HD000000000{000000000{00032ODSS                                HCS1
>
> newvalue=65
> so it will be
> 20070302
> HD000000000{000000000{00065ODSS                                HCS1

It is hard to know from your post if the "20070302" is part of the text
string or not, so I assumed it was. Also, it is hard to know from your post
if the location of the  You can use this code as a model....

TheString = "20070302" & vbCrLf & _
            "HD000000000{000000000{00065ODSS" & _
            "                                HCS1"
Mid$(TheString, InStr(TheString, "{00065") + 4) = "32"

Rick