excel vba write string to text file

The solution for “excel vba write string to text file” can be found here. The following code will assist you in solving the problem.

‘VBA function to write string to text file:

Function SaveStringAsTextFile$(s$, fName$)
Const adSaveCreateOverWrite = 2
With CreateObject(“ADODB.Stream”)
.Charset = “utf-8”
.WriteText s
.SaveToFile fName, adSaveCreateOverWrite
End With
End Function

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts