Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading the Next Line - Problem with Spaces

Status
Not open for further replies.

BAWC01

Technical User
Nov 23, 2005
79
CH
Hi I have the following text

Code:
16.11.05 00:48:12 SMP _CASE: received fcode: 3409
16.11.05 00:48:12 SMP _AWBGRP_INS: '125-54725322' 4 'D' 'BA 215  16NOV05' 0 'PMC
          76364BA'
16.11.05 00:48:12 SMP _CASE: Answer send with state: 0
16.11.05 00:48:13 SMP _CASE: received fcode: 3416
16.11.05 00:48:13 SMP _PARCEL_LOCATION: '125-27856080' 0 4 M -> L

The problem is reading the following line

Code:
16.11.05 00:48:12 SMP _AWBGRP_INS: '125-54725322' 4 'D' 'BA 215  16NOV05' 0 'PMC
          76364BA'

Which is broken over two lines

I use the following to read in the line

Code:
          If Mid(TxtString, 19, 15) Like "SMP _ULD_PRIMOS" Then
            SMP_ULD_PRIM (TxtString)

But this only gives me one line, how can I read join the two lines together ?

Thanks

Phil
 
Do you mean something like:
Code:
Open "C:\imptext.txt" For Input As #1
Do While Not EOF(1)    ' Loop until end of file.
    Line Input #1, strImp    ' Read line into variable.
        If Mid(strImp, 19, 3) <> "SMP" Then
            strText = strText & strImp
        Else
            strText = strImp
        End If
    Debug.Print strText    ' Print to the Immediate window.
Loop
Close #1    ' Close file.
 
Rem

Does this read each line then evaluate the string, if it's SMP does it them add on the second part of the string ?

Phil
 
If the line contains SMP at position 19, it is treated as a new line; if it does not, it is added to the previous line. (I hope.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top