Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have this text file which I need to edit.
Edit has to be done one line at a time.
I was wondering how to save and close the text file after editing!!

Thanks...

What I have tried:

Public Sub edit_sub()

Dim myFile As String
Dim opFile As Integer
myFile = "fileLocation"

opFile = FreeFile
Open myFile For Input As opFile


Do Until EOF(opFile)
    Line Input #opFile, txtline
    Debug.Print txtline
    
    'check some condition and then edit
    'replace the value
Loop

Close opFile

End Sub


Where to put the code to save the text file?
Posted
Updated 1-Feb-17 20:45pm
v2
Comments
[no name] 27-Jan-17 9:38am    
"Where to save the text file?", anywhere you want.
planetz 2-Feb-17 2:14am    
Pardon...it is how to save the text file? I'l edit the question

1 solution

 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900