I have a small piece of code that will log:
My question/problem is, I want to run this code, and then save the workbook. So this information will be saved even if the user closes workbook without saving. Here is what I have for code:
However when I try to close the workbook, I am still being prompted to save changes, when the only change that was made was the logging of info. Can someone offer a solution to my problem?
Very much appreciated
- Application.UserName
- Environ("username")
- Format(Now, "yyyy-mm-dd hh:mm")
My question/problem is, I want to run this code, and then save the workbook. So this information will be saved even if the user closes workbook without saving. Here is what I have for code:
Code:
Private Sub Workbook_Open()
Dim LastRow As Long
LastRow = Cells(Rows.Count, 3).End(xlUp).Row + 1
Sheets("Sheet1").Cells(LastRow, "A").Value = Application.UserName
Sheets("Sheet1").Cells(LastRow, "B").Value = Environ("username")
Sheets("Sheet1").Cells(LastRow, "D").Value = Format(Now, "yyyy-mm-dd hh:mm")
ThisWorkbook.Save
App.DisplaAlerts = True
End Sub
However when I try to close the workbook, I am still being prompted to save changes, when the only change that was made was the logging of info. Can someone offer a solution to my problem?
Very much appreciated