Solved

Left() and Mid() reading tab spacing

Posted on 2003-10-26
4
257 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now