If you want this log to be copied in the case that the application terminates normally (user closed it, not a fatal error or end task from task manager), then you can put that code in the main form's Form_Unload event.
Form_Unload(Cancel as Integer)
'write appropriate stuff to the log here
'to retrieve the date/time, use these keywords:
Date 'short date (7/18/01)
Time '(8:10:04 AM)
Now '(7/18/01 8:10:04 AM)
'to copy a file, use the FileCopy command:
FileCopy "c:\MySourcePath", "c:\MyDestPath"
End Sub
If you want the date appended to the end of the log file name, you may run into issues regarding the fwdslashes (\), since this is a separator between files. In that case, write a function that replaces the \ in a date with the underscore or something.
Hope that helped!
-Mike