Kelloggs
Active Member
Do crazy people know they are crazy?
Posts: 785
Gender:
|
I need to insert a line into a text file This is my text file Canada USA England How do I insert some text between lines 1 and 2? Canada France USA England Can it be done with VBA? Thank you all, Kelloggs Function insert_fnpath() Dim fso As New Scripting.FileSystemObject Dim thepath As String Dim ftext Dim ntext thepath = "N:\1CNC\DATA\625\FISCON0100\6252018.txt" Set ftext = fso.OpenTextFile(thepath, ForReading) x = ftext.ReadLine ftext.SkipLine x = ftext.Read(4) ftext.Close Select Case x Case "(FN-" 'Overwrite line with "(FX-) Case Else 'Insert New Line after Line 2 End Select Set fso = Nothing end Function
|