Solved

Left() and Mid() reading tab spacing

Posted on 2003-10-26
4
261 Views
Last Modified: 2010-05-03
i have tabs separating fields in a .txt file.

the only way that i can get the Left() or Mid() statement to work right is if i take out the tabs and put in all spaces up to the max character position.
is there any way that i can read tab spaces. my code says:

    If thefile.AtEndOfStream = False Then
        thetext = thefile.ReadLine
        lblname.Caption = Left(thetext, 24)
    End If

(with tab spacing), when i put a breakpoint in my program, i want thetext to read "Timmy Thompson", but instead it reads "Timmy Thompson[]13[]OH[]".....where 13 and OH are age and state. but still it doesn't read the tabspacing.

i know this may not seem real clear, but either is my head right now....if you need more specification, let me know....otherwise, your help is appreciated.
jeremy
0
Comment
Question by:daleyjem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
fantasy1001 earned 25 total points
ID: 9624711
use array
dim myarray() as string
myarray = split (thetext, "[]")

'myarray(0) is the name

Thank & cheers
0
 
LVL 7

Expert Comment

by:_agj_
ID: 9625021
u cud do a :
string1 = Replace(string1, vbtab, " ")
0
 
LVL 4

Author Comment

by:daleyjem
ID: 9627881
i'll give the "replace" a try and get back to ya...
0
 
LVL 4

Author Comment

by:daleyjem
ID: 9628412
the replace didn't work because it only puts one space for each tab which isn't what i was looking for. the array worked perfectly except i just used "vbTab" in place of the "[]"....

awesome...thanks...now i know something about "split"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question