用什么函数啊????

解决方案 »

  1.   

    Sub 删除文件中一行(strSourceFile As String, strTargetFile As String,intRow as long)
        Dim filenum         As Integer
        Dim fileContents    As String
        Dim fileInfo()      As String
        Dim i               As Integer
        Dim j               As Integer
        
        Dim tmpDemData As String
        filenum = FreeFile
        Open strSourceFile For Binary As #filenum
            fileContents = Space(LOF(filenum))
            Get #filenum, , fileContents
        Close filenum
        fileInfo = Split(fileContents, vbCrLf)
        '取出源文件行数,按照回车换行来分隔成数组
        
        filenum = FreeFile
        tmpDemData = ""
        If Dir(strTargetFile, vbNormal) <> "" Then
            Kill strTargetFile
        End If
        Dim Filestr() As String    Open strTargetFile For Append As #filenum
            '循环每一行
            For i = 0 To UBound(fileInfo) - 1
                if i<>intRow-1 then
                    Print #filenum, fileInfo(i)
                end if
            Next
        Close #filenum
        MsgBox "完毕"
    End SubPrivate Sub Command1_Click()
        删除文件中一行 "d:\aa.txt", "d:\bb.txt",1
    End Sub
      

  2.   

    用line input读取第一行,然后把剩下的读取出来,关闭文件,然后在写入就行了