Replace a Single Line in a File (ini, cfg, txt, etc...)
Category:
Files and DirectoriesType:
ModulesDifficulty:
BeginningAuthor:
AnonymousVersion Compatibility: Visual Basic 6
More information:
Copy this code into a module and call the function as, Call ReplaceLine("C:\test.txt", 58, "I am Line 58"). This module will return Error 62 if the file has less than 1 line. It returns Error 32202 if it was unable to replace the line at the line number you specified.
Instructions: Copy the declarations and code below and paste directly into your VB project.
Declarations: