Hi,
I'm trying to parse out some information from a file. I want to get everything between "D 12" and "D 13".

When I've managed that I want to get out data one after one. The format is given below:

Code:
...
lots of text
...
 D 12  Final trend cycle
  From  2002.Jan to 2005.Dec
  Observations         48
  Trend filter    23-term Henderson moving average
  I/C ratio        6.20
 -----------------------------------------------------------------------------
               Jan      Feb      Mar      Apr      May      Jun 
               Jul      Aug      Sep      Oct      Nov      Dec        TOTAL  
 -----------------------------------------------------------------------------
  2002          49.      52.      54.      57.      60.      63.
                66.      68.      71.      74.      76.      77.          766.
 
  2003          78.      78.      78.      78.      78.      77.
                77.      76.      76.      77.      78.      79.          931.
 
  2004          80.      81.      82.      83.      84.      85.
                86.      87.      88.      88.      88.      89.         1020.
 
  2005          89.      90.      91.      92.      93.      94.
                95.      96.      96.      96.      96.      96.         1125.
 
  AVGE          74.      75.      76.      78.      79.      80.
                81.      82.      83.      84.      85.      85.

  Table Total-      3842.39   Mean-      80.05   Std. Dev.-      12.06
                              Min -      48.61        Max -      96.39
        ICMETI,  Total Inventories Communications Equipment            PAGE  10, SERIES foo

 D 13  Final irregular component
...
lots of text
...
I've tried this to get data:
Code:
Sub Command1_Click() 
    text1 = "" 
    Dim tempvar As String 
    Open "I:\Jørgen\diverse\test\FOO.OUT" For Input As #1 
    Do While Not EOF(1) And LCase(tempvar) <> " D 12" 
        Input #1, tempvar 
    Loop 
    If Not EOF(1) Then 
        Do While Not EOF(1) And LCase(tempvar) <> " D 13" 
            Input #1, tempvar 
            If LCase(tempvar) <> "stop" Then 
                text1 = text1 + tempvar + Chr(13) + Chr(10) 
            End If 
        Loop 
    End If 
    Close #1 
    Debug.Print text1 
End Sub
but without success.. If I input som other strings into the Sub like f.ex "start" and "stop" and also enter those data into the file I'm parsing it works OK. But I really need to do it without manually entering "start" and "stop" into the file..

Any suggestions?

Thanks in advance for any help!