View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Parsing Data String from text file line

On 21 Apr 2007 11:01:10 -0700, gtslabs wrote:

I am having trouble parsing the data line extracting the correct lines
using string commands.
Is there an easier way to get this info?


The Split function should do what you want:

==================================
Sub ParseLine()
Const sTest As String = "Data1|Data2|Data3|Data4|Data5|Data6|Data7|Dat a8"
Dim arrData As Variant
Dim i As Long

arrData = Split(sTest, "|")

For i = 5 To 7
Debug.Print i, arrData(i - 1)
Next i

End Sub
================================
--ron