supernova122
MIS
Hi,
How do I write something to a text file using the Code?
Please give me an example. Thanks.
Supernova
How do I write something to a text file using the Code?
Please give me an example. Thanks.
Supernova
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Sub WriteFile(ByVal strFile As String, ByVal strText As String)
On Error GoTo ErrHandler
Dim fso As New FileSystemObject
Dim ts As TextStream
If Dir(strFile) = "" Then
Set ts = fso.CreateTextFile(strFile)
ts.Close
End If
Set ts = fso.OpenTextFile(strFile, ForAppending)
ts.Write strText
ts.Close
ExitHere:
On Error Resume Next
Set ts = Nothing
Set fso = Nothing
Exit Sub
ErrHandler:
MsgBox "Error " & Err & " - " & Err.Description
Resume ExitHere
End Sub