Replace a single line of a file. For example replace one line of a .cfg or a .ini, in order to alte
Replace a single line of a file. For example replace one line of a .cfg or a .ini, in order to alter program settings or outside variables,
Rate Replace a single line of a file. For example replace one line of a .cfg or a .ini, in order to alte
(1(1 Vote))
Dim Str As String
Dim newFileContent As String
Dim i As Integer
lineNumber = lineNumber - 1
i = 1
Open filePath For Input As #1
Input #1, Str
newFileContent = Str
Do While Not EOF(1)
If i = lineNumber Then
Input #1, Str
Str = replacementText
newFileContent = newFileContent + vbNewLine + Str
Else:
Input #1, Str
newFileContent = newFileContent + vbNewLine + Str
End If
i = i + 1
Loop
Close #1
If i < lineNumber Then Error (32202)
Open filePath For Output As #1
Print #1, newFileContent
Close #1
End Function
Replace a single line of a file. For example replace one line of a .cfg or a .ini, in order to alte Comments
No comments yet — be the first to post one!
Post a Comment