Hi all,
I utilise Application.OnTime to perform RefreshAll to obtain data regularly and then perform some calculations based on this data. When switching between workbooks I use Workbook_WindowDeactivate and Workbook_WindowActivate to stop and start this timer so the data is not updated until the OnTime time is passed and the user is looking at the workbook again.
This is working fine for when a user moves from 1 workbook to another, however Workbook_WindowDeactivate and Workbook_WindowActivate are not triggered if the user changes window to another application or if they lock their computer. This means an attempt is made to refresh the data in the background, producing some error messages and/or a period of lag for the user as it is processed. Is there a similar method to WindowActivate/WindowDeactivate to cope with this situation? Are there "Lost focus" and "Gain focus" type events that I have not found in my searches?
Thank you in advance
AidanVBA