Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9167615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:26:03+00:00 2026-06-17T15:26:03+00:00

I want to show a message 20 seconds after opening the Excel workbook. Code

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:26:04+00:00Added an answer on June 17, 2026 at 3:26 pm

    Here’s a workaround:

    Sub main()
    
        Dim start As Single
    
        start = Timer
    
        Do
            DoEvents
        Loop Until Timer > (start + 20) '20 seconds
        MsgBox "hello"
    
    End Sub
    

    Edit. Code for further question:

    In a module called Module1, enter the following code:

    Public start As Single
    
    Sub main2()
    
        start = Timer
    
        Do
            DoEvents
        Loop Until Timer > (start + 20) '20 seconds
        MsgBox "hello"
    
    End Sub
    

    In your ThisWorkbook object (double click on ThisWorkbook from the list of objects in the Project Explorer) enter the following code:

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        Module1.start = Module1.start + 5
    End Sub
    

    Every time any cell in any worksheet in the workbook is changed, another five seconds is added to the timer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to show a jquery popup message after the user creates any record
I have a JSPX (X!) page where I want to show an exception (message
Hi I want to show the number of characeters left for a message while
I have a div to show a message, I want the message to appear
I want show an information page after success db opartions. And after the info
I want show annotation view (above one of my pin) after load map. For
I want to show an alert message if user click on second tan without
<div id=messages> <div class=message> <!-- Visible (5 seconds for hide, show the next, and
If I want to show messages in a threaded conversation, which layout should I
hii I want show a pop up Dialog box when i click on to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.