用法:
DeleteLineFromFile App.Path & "/test.txt", 3
函数:
Public Sub DeleteLineFromFile(RFile As String, RLine As Integer)
Dim FileNum As Integer
Dim TextLine As String
Dim NewText As String
Dim CurentLine As Integer
FileNum = FreeFile
Open RFile For Input As #FileNum
Do Until EOF(FileNum)
Line Input #FileNum, TextLine
currentline = currentline + 1
If Not currentline = RLine Then
If currentline = 1 Then
NewText = TextLine
Else
NewText = NewText & vbNewLine & TextLine
End If
End If
Loop
Close #FileNum
Open RFile For Output As #FileNum
Print #FileNum, NewText
Close #FileNum
End Sub