dim inMsg as string, outMsg as string, Temp as string
close #1
open "1.txt" for input as #1
close #2
open "2.txt" for output as #1
do until eof(1)
    read #1, inMsg
    outMsg=right(inMsg, len(inMsg)-3)
    outMsg=left(outMsg, len(outMes)-11)
    temp=right(inMsg, 11)
    temp=trim(val(temp))
    outMsg=outMsg & temp
    print #2, outMsg
loopOK, hehe

解决方案 »

  1.   

    各位帮忙呀!!
    TO:onlineboy(stame) read #1, inMsg 这句通部过呀!老是是说子程序或函数未定义!
    详细点,我是初学者!!
      

  2.   

    按onlineboy(stame) 的方式,再看看MSDN中关于文件操作的部分,自己写一写,对你会有很大的提高(在文件操作方面)。
      

  3.   

    Private Sub Form_Load()
        Dim nStr() As String
        Dim lineStr As String
        Dim i As Long
        
        Open "c:\1.txt" For Input As #1
        Open "c:\2.txt" For Output As #2
        Do Until EOF(1)
            Line Input #1, lineStr
            nStr = Split(lineStr, "|")
            nStr(LBound(nStr)) = Right(nStr(LBound(nStr)), 4)
            nStr(UBound(nStr)) = Format(Val(nStr(UBound(nStr))))
            lineStr = ""
            For i = LBound(nStr) To UBound(nStr)
                lineStr = lineStr & "|" & nStr(i)
            Next i
            lineStr = Mid(lineStr, 1)
            Print #2, lineStr
        Loop
        Close #1
        Close #2
    End Sub
      

  4.   

    to blp(★★★) 
    谢了!出来的效果是
    |3958|1234567             |张涛                          |2000
    |3959|12334455            |爱吗而                        |2000
    |3960|12345678            |jjjj                          |5000
    |3961|12345678            |jjjj                          |10000
    |3962|1234567890          |1234                          |2000
    |3963|12345678            |jjjj                          |50000
    |3964|1234567             |123                           |2000
    |3965|12334455            |abc                           |55555555.55
    |3966|1234567             |123                           |99999999.99
    |4113|1234567             |123                           |88888888.88前面多了个“|”,如何使出来的效果使3964|1234567             |123                           |2000
    3965|1234567             |123                           |2000
    3966|1234567             |123                           |2000
      

  5.   

    lineStr = Mid(lineStr, 1)改成lineStr = Mid(lineStr, 2)