i have a file txt that is Code,Surname, Phone Number,Telefax
I do a loop to look the first 5 char of the string to read if the code is
the one entered
Do while not eof(1)
. line input #1, strBuffer
if mid(strBuffer,1,5) = txtCodeEntered.text then
......
How can i store the Surname tht is starting fixed at row 6 but variable
lenght?
Dave Lett - 26 Jan 2006 18:10 GMT
Hi,
If you're willing to reconsider how you import your information, then you
might be able to use the Split () function, as in the following example:
Dim sString As String
Dim aArray
Dim iCounter As Integer
sString = "Code,Surname,Phone Number,Telefax"
aArray = Split(Expression:=sString, Delimiter:=",")
For iCounter = 0 To UBound(aArray)
MsgBox aArray(iCounter)
Next iCounter
HTH,
Dave
> i have a file txt that is Code,Surname, Phone Number,Telefax
>
[quoted text clipped - 8 lines]
> How can i store the Surname tht is starting fixed at row 6 but variable
> lenght?
MarcoPolo - 26 Jan 2006 18:51 GMT
SUPER!!!!!!!!!
> Hi,
>
[quoted text clipped - 25 lines]
>> How can i store the Surname tht is starting fixed at row 6 but variable
>> lenght?
Peter Jamieson - 26 Jan 2006 18:16 GMT
> Code,Surname, Phone Number,Telefax
suggests that your file is comma-delimited. If so, you could use
Do while not eof(1)
. line input #1, strBuffer
if mid(strBuffer,1,5) = txtCodeEntered.text then
strSurname = Mid(strBuffer,7,InStr(7,strBuffer,",")-7)
if there is no guarantee that there are "," characters aftert the Surname,
you can use
strSurname = Mid(strBuffer & ",",7,InStr(7,strBuffer & ",",",")-7)
Peter Jamieson
>i have a file txt that is Code,Surname, Phone Number,Telefax
>
[quoted text clipped - 8 lines]
> How can i store the Surname tht is starting fixed at row 6 but variable
> lenght?