VB Code for Log or Tracking

Dim LFNum As Integer
Dim PLFName As String
'blnfileopen As Boolean

Public Sub OpenFile()
LFNum = FreeFile
PLFName = App.Path & "proglog" & Format(Day(Date), "00") & Format(Hour(Time), "00") & Format(Minute(Time), "00") & Format(Second(Time), "00") & ".txt"
Open PLFName For Output As LFNum
Print #LFNum, "Logging Started at....." & Date; " "; Time
Print #LFNum, ""
'blnfileopen = True
End Sub

Public Sub LogData(msg As String)
'If Not blnfileopen Then OpenFile
Print #LFNum, msg
End Sub

Public Sub closefile()
Print #LFNum, ""
Print #LFNum, "***** Session Close at " & Date; " "; Time; "*****"
Close LFNum
End Sub