Ironman
Well-known Member
- Joined
- Jan 31, 2004
- Messages
- 1,069
- Office Version
- 365
- Platform
- Windows
Hi
When I manually save the workbook the below code inserts the last time I manually saved the workbook into cell A1 of sheet 'Training Log' (named "SaveTime").
This has worked without any problem for years, but I have just converted from Office 2021 to Microsoft 365 and now it errors Runtime Error 5.
Can you tell me what I need to change to make this work again?
Many thanks!
When I manually save the workbook the below code inserts the last time I manually saved the workbook into cell A1 of sheet 'Training Log' (named "SaveTime").
This has worked without any problem for years, but I have just converted from Office 2021 to Microsoft 365 and now it errors Runtime Error 5.
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.EnableEvents = False
Range("SaveTime") = "Last saved" & Format(Time, " h:mmam/pm") & ", " & Round(FileLen(ActiveWorkbook.FullName) / 1000000, 1) & "Mb"
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
Can you tell me what I need to change to make this work again?
Many thanks!