Mick Peters
Board Regular
- Joined
- May 18, 2015
- Messages
- 93
Hi I am new to this but am finding my way around using several pieces of code found on the web so I may look more advanced than I am.
Most of the code I have found does an auto save then a close. what I need is to be able to auto save but without the close. possibaly a message box open while the save is going on.
I have work sheets that are locked all except coulmn A and the users scan into the cells in column A and the work sheet does the rest. If there are no scans within 5 min then I would like to save the workbook.
I currently have this but it dose not account for inactivity,
Sub AutoSave()
dTime = Time + TimeValue("00:05:00")
With Application
.OnTime dTime, "AutoSave"
.EnableEvents = False
.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\Autosave.xlsm"
.EnableEvents = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime dTime, "AutoSave", , False
End Sub
Private Sub Workbook_Open()
dTime = Time + TimeValue("00:05:00")
Application.OnTime dTime, "AutoSave"
End Sub
Most of the code I have found does an auto save then a close. what I need is to be able to auto save but without the close. possibaly a message box open while the save is going on.
I have work sheets that are locked all except coulmn A and the users scan into the cells in column A and the work sheet does the rest. If there are no scans within 5 min then I would like to save the workbook.
I currently have this but it dose not account for inactivity,
Sub AutoSave()
dTime = Time + TimeValue("00:05:00")
With Application
.OnTime dTime, "AutoSave"
.EnableEvents = False
.DisplayAlerts = False
ThisWorkbook.SaveAs "C:\Autosave.xlsm"
.EnableEvents = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime dTime, "AutoSave", , False
End Sub
Private Sub Workbook_Open()
dTime = Time + TimeValue("00:05:00")
Application.OnTime dTime, "AutoSave"
End Sub