本帖最后由 yihuiating 于 2012-09-27 10:53:01 编辑

解决方案 »

  1.   

    Private Sub Command1_Click()
          Dim strInput$, ID$, IDsave$, arrText$()
          Dim strTemp$, i&
       ' 这里的文件路径,自己处理
       Open "X:\Temp\IN_file.txt" For Input As #1
       Open "X:\Temp\Out_Text.txt" For Output As #2
       IDsave = ""
       Do
          If (EOF(1)) Then Exit Do
          Line Input #1, strInput
          If (Len(strInput) = 0) Then Exit Do
          arrText = Split(strInput, " ")
          i = InStr(arrText(0), "=") + 1
          ID = Mid$(arrText(0), i)
          If (ID <> IDsave) Then
             IDsave = ID
             Print #2, ID
          End If
          i = InStr(arrText(1), "=") + 1
          Print #2, Mid$(arrText(1), i)
       Loop
       MsgBox "处理完毕!", vbInformation
    End Sub
      

  2.   

    MsgBox之前忘记写 Close了,不好意思。
    还有 strTemp 也是多余的。
      

  3.   

    感谢Chen8013
    我把这个想复杂了,弄了一天没弄好,你用Split函数处理后,简单明了多了,谢谢!