I have a macro which auto saves the workbook every 5 minutes to avoid losing data. The workbook is set up with a data connection to collect production data from a PLC controller and production operators can also enter notes into the workbook.
The problem is that if someone started entering a note but didn't confirm the entry by pressing enter or tab or by clicking on a different cell then the auto save macro will not execute and the workbook will not be saved until the focus changes to another cell.
I tried to change the active cell in the macro right before executing the save statement, but that didn't work. Is there a way to accept the entered (but not confirmed) cell contents before attempting to save the file? Is there another solution that I haven't thought about?
This is the macro code:
Sub AutoSaveAs()
dTime = Time + TimeValue("00:05:00")
With Application
.OnTime dTime, "AutoSaveAs"
.EnableEvents = False
.DisplayAlerts = False
ActiveCell.Offset(1, 0).Select 'This is the code where I tried to change the active cell
ThisWorkbook.SaveAs "//ThisFilePath/ThisWorkbookName"
.EnableEvents = True
End With
End Sub