Private Sub m_frm_AfterUpdate()
Dim myFileSystemObject As FileSystemObject
Dim myFile As Object
Dim strFileN As String
On Error Resume Next
Set myFileSystemObject = New FileSystemObject
strFileN = "C:\MyCust.txt"
Set myFile = myFileSystemObject.GetFile(strFileN)
If Err.Number = 0 Then
' open text file
Set myFile = myFileSystemObject.OpenTextFile(strFileN, 8)
Else
' create a text file
Set myFile = myFileSystemObject.CreateTextFile(strFileN)
End If
myFile.WriteLine "File Created on: " & Date & " " & Time
myFile.Close
Set myFileSystemObject = Nothing
End Sub
|