Excel VBA to Append the range to text file RRS feed

  • Question

  •  l have exce data where it will calculate monthly payment chart to each customers. My VBA code is writing the contents to text file successfully. However the problem is it is not aligned to pages so that I capn take the print out properly. As it depends on the

    repayment tenure, there is no fixed length.  Is there any way to get rid of this.. Below is the sample code:

    Sub WriteToATextFile()

    MyFile = "c:\" & "MyTextFile.txt"
    fnum = FreeFile()
    Open MyFile For Append As fnum
    Write #fnum, "I wrote this"
    Write #fnum,
    Print #fnum, "I printed this"
    Close #fnum
    End Sub


    • Edited by XLlearner Friday, October 18, 2019 2:28 PM
    Friday, October 18, 2019 2:24 PM