ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete a line in text file (https://www.excelbanter.com/excel-programming/300853-delete-line-text-file.html)

Francis Ang[_2_]

Delete a line in text file
 
I have created a text file using the Open Statement. How do I delete a specific line say line 4 of the text file using VBA. Any help is very much appreciated. TIA

Tom Ogilvy

Delete a line in text file
 
workbooks.open "C:\My Files\Myfile.txt"
Rows(4).EntireRow.Delete
workbooks.Close SaveChanges:=True

--
Regards,
Tom Ogilvy

"Francis Ang" <Francis wrote in message
...
I have created a text file using the Open Statement. How do I delete a

specific line say line 4 of the text file using VBA. Any help is very much
appreciated. TIA



Francis Ang[_3_]

Delete a line in text file
 
Thanks Tom.

"Tom Ogilvy" wrote:

workbooks.open "C:\My Files\Myfile.txt"
Rows(4).EntireRow.Delete
workbooks.Close SaveChanges:=True

--
Regards,
Tom Ogilvy

"Francis Ang" <Francis wrote in message
...
I have created a text file using the Open Statement. How do I delete a

specific line say line 4 of the text file using VBA. Any help is very much
appreciated. TIA





All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com