Public Sub gWriteLog(pFileName, pMessage)
    On Error Resume Next '* you don't want an error occurring when trying to log an error!
    Dim hFile%
    hFile = FreeFile
    strLogFile = pFileName
    Open strLogFile For Append Access Write Lock Write As #hFile
    Print #hFile, Format(Now(), "mm/dd/yy hh:mm:ss") & " *** " & s$
    Close #hFile
End Sub
Sub create_LogFile()
gWriteLog ("C:\Users\Ajeet\Desktop\log.txt"), ("hello")
End Sub