Output a text file


Option Explicit
Sub sbTest()
 MsgBox fnOutputToFile("Hello World")
End Sub

Public Function fnOutputToFile(sTextToOutput As String) As Boolean

    Dim sFilename As String
    sFilename = ThisWorkbook.Path & "\out" & Format(Now(), "yyyymmddHHMMSS") & ".txt"

    Open sFilename For Output As #1
    Print #1, Now()
    Print #1, "sTextToOutput " & sTextToOutput
    Print #1, "**END**"
    Close #1

    fnOutputToFile = True

End Function