一个文本文件的第一行是  XX,用 VB 修改为 yy.
请给出代码,如果引用对象,请说明。

解决方案 »

  1.   

    dim mw as string
    mw=yy
    Open App.Path + "\*.txt" For Output As #1
    Write #1, mw
    Close #1
      

  2.   

    楼上的还得加上这样的代码(否则将会只得到内容为一句YY的文件):
    dim tmpTag as integer
    dim tmp as string
    dim mw as string
       mw =yy   tmptag =1
       Open App.Path & "\A.txt" For input As #1
      
       do until eof(1)
       input #1, tmp
          open app.path & "\B.txt" for append as #2
          if tmp = XX and tmptag =1 then
             write #2, mw
          else
             write #2, tmp
          end if
          close #2
          tmptag = tmptag +1 
       loop 
       
       Close #1   Kill app.path & "\A.txt"
    '然后将B.txt命名为A.txt