Answers for "vba write text file"

VBA
12

excel vba write string to text file

'VBA function to write string to text file:

Function SaveStringAsTextFile$(s$, fName$)
    Const adSaveCreateOverWrite = 2
    With CreateObject("ADODB.Stream")
        .Charset = "utf-8"
        .Open
        .WriteText s
        .SaveToFile fName, adSaveCreateOverWrite
    End With
End Function
Posted by: Guest on May-02-2020
1

vba write text file

Open ThisWorkbook.Path & "\log.txt" For Append As #1
Write #1, "Here is my text."
Write #1, "Another line."
Close #1
Posted by: Guest on February-18-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language