Writing Text Files : Text File « File Path « VBA / Excel / Access / Word






Writing Text Files

 
Sub WriteFile()
    ThisFile = "C:\Results.txt"

    On Error Resume Next
    Kill (ThisFile)
    On Error GoTo 0

    Open ThisFile For Output As #1
    FinalRow = Range("A65536").End(xlUp).Row
    For j = 1 To FinalRow
        Print #1, Cells(j, 1).Value
    Next j
End Sub

 








Related examples in the same category

1.Create and Save Text file
2.Save Date and Time information to a text file
3.Filtering a text file
4.Read a text file, skipping the Total lines
5.Read a text file, adding the amounts
6.Reading Text Files One Row at a Time
7.Use a Do...While loop to keep reading records until you've reached the end of the file: