| 'Just place this in a Module and you can call it from anywhere in your program! Sub SetLog(Message As String) 'This Sub writes to a LOG file. Dim theFile As String, theMessage As String theFile = App.Path & "\PRGMLOG.TXT" theMessage = Message & vbCrLf Open theFile For Append As #1 Print #1, theMessage Close #1 End Sub 'To use the above function, just call SetLog("The message to write in the log"). 'Considering that it is a log file, you may want to replace the log each time... To do this, 'just call the next function. It will delete the existing Log (if it does exist). Sub KillLog() 'This sub deletes the old LOG file On Error Resume Next 'err check on Kill App.Path & "\PRGMLOG.TXT" 'Delete log On Error GoTo 0 'err check off End Sub 'To use the above function, just call KillLog. |
LOG Files |
Express News India | Freelance ecommerce web development India