I want to show a message 20 seconds after opening the Excel workbook. Code is:
//ThisWorkbook
Private Sub Workbook_Open()
SetTimer
End Sub
//Module1
Public Sub SetTimer()
Application.OnTime Now + TimeValue("00:00:20"), "ShowMsg"
End Sub
Public Sub ShowMsg()
MsgBox ("my message")
End Sub
As you see, code is very simple and it works when user don’t update sheet or when they leave updated/focused cell. However, if cursor remains at cell the message will never be shown. It seams that control doesn’t return to VBA code while a cell has focus or is updating. Any idea for this issue? Thanks
Here’s a workaround:
Edit. Code for further question:
In a module called Module1, enter the following code:
In your ThisWorkbook object (double click on ThisWorkbook from the list of objects in the Project Explorer) enter the following code:
Every time any cell in any worksheet in the workbook is changed, another five seconds is added to the timer.