I am trying to create a file and save text into it. I tried below code but when I am using write #1, script will just replace existing text with the new text. I tried write #0 but no luck. Any suggestions.
Sub TestResultFile(output As String)
Dim myFile As String
myFile = Application.DefaultFilePath & "TestResults.txt"
Debug.Print myFile
Open myFile For Output As #1
Write #1, output
Close #1
End Sub
Update:
Answer by Lakshmi helped me solve this issue.
Open myFile For Append As #1For OutputuseFor Append. Then write youroutputstring to the file and it should not replace existing text