Option Explicit Private Enum EOutputType Append = 1 Output = 2 End Enum Dim mbolDeleteFile As Boolean Dim mstrOutputFolder As String Dim mstrFileName As String Dim mstrFullPath As String Private Sub Class_Initialize() mbolDeleteFile = False mstrOutputFolder = "" mstrFileName = "" End Sub Public Property Get FileName() As String FileName = mstrFileName End Property Public Property Let FileName(val As String) mstrFileName = val End Property Public Property Get OutputFolder() As String OutputFolder = mstrOutputFolder End Property Public Property Let OutputFolder(val As String) If Right(Trim(val), 1) <> "\" Then val = Trim(val) & "\" End If If Dir(val, vbDirectory) = "." Then mstrOutputFolder = val Else Err.Raise vbObjectError + 513, "Log Actions Method", "Directory does not exist" End If End Property Public Property Get DeleteFile() As Boolean DeleteFile = mbolDeleteFile End Property Public Property Let DeleteFile(val As Boolean) mbolDeleteFile = val End Property Public Function LogAction(ByVal mstrOutput As String) On Error GoTo ErrorTrap mstrFullPath = mstrOutputFolder & mstrFileName If mbolDeleteFile = True Then mbolDeleteFile = False If Len(Dir(mstrFullPath, vbNormal)) > 0 Then Call Kill(mstrFullPath) End If End If Call WriteToFile(mstrFullPath, Now & ": " & mstrOutput, Append) ExitSub: Exit Function ErrorTrap: GoTo ExitSub End Function Private Function WriteToFile(ByVal strFileName As String, ByVal strString As String, ByVal OutputType As EOutputType) As Boolean Dim strForType As String Select Case OutputType Case Append Open strFileName For Append As #1 Case Output Open strFileName For Output As #1 End Select Print #1, strString Close #1 End Function