Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcoPolo - 26 Jan 2006 16:44 GMT
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?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.