View Single Post
  #2   Report Post  
Old June 4th 19, 08:49 AM posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
First recorded activity by ExcelBanter: Apr 2015
Posts: 1,182
Default Why the heck doesn't this work?

The file data.txt contains the following string:
(There's a tab char just after the a123)

a123 A. BC #123

Oh.., now you tell us! Any other *very important details* like this we need to

Sub ParseTextFile2a()
Dim vTmp, sLine$
Const sFile$ = "C:\Data.txt"
sLine = ReadTextFile(sFile)
vTmp = Split(sLine, vbTab)
Debug.Print Trim(vTmp(0)) '//returns "a123"
Debug.Print Trim(vTmp(1)) '//returns "A. BC #123"
'//where the file contains "a123", a Tab followed by "A. BC #123"
vTmp = Split(vTmp(1), " ")
Dim n&
For n = LBound(vTmp) To UBound(vTmp)
Debug.Print vTmp(n)
Next 'n
'"A. BC #123"
End Sub


Free usenet access at
Classic VB Users Regroup!