Log files are useful in different situations, specially for developers. Log files are plain text files that can store information temporary or more permanent. You don’t need much code to create a log file:
1 2 3 4 5 6 7 8 |
Sub log(LogMessage As String) Const LogFileName As String = "C:\temp\textfile.html" Dim fileNum As Integer fileNum = FreeFile ' next file number Open LogFileName For Append As #fileNum ' creates the file if it doesn't exist Print #fileNum, LogMessage ' write information at the end of the text file Close #fileNum ' close the file End Sub |
How to use?
1 2 3 |
Sub log_the_information() log ("What is Lorem Ipsum? Lorem Ipsum is simply dummy text.") End Sub |