Private Sub WriteToLog(str As String) Dim LogDir As String, LogFile As String LogDir = App.Path & "\logs" Dim fs As FileSystemObject Dim ts As TextStream If DirExists(LogDir) = False Then CreateFolder (LogDir) End If LogFile = App.Path & "\logs\" & "Log_" & qCaption & Chr$(32) & Format(Now, "d-m-yyyy") & ".txt" Set fs = New FileSystemObject Set ts = fs.OpenTextFile(LogFile, ForWriting, True) ts.WriteLine str ts.Close End Sub