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

  • SEARCH
  • Home
  • 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 9021011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:09:22+00:00 2026-06-16T05:09:22+00:00

I want to generate a 30 seconds delay in vba. I can’t use ‘Timer’

  • 0

I want to generate a 30 seconds delay in vba. I can’t use ‘Timer’ as my application will run overnight till next morning. (Timer will generate the seconds(in fraction) elapsed till midnight). Is there any other way to achieve this other than Timer and Application.WaitNow().
I tried using the following code but it throws Code execution has been interrupted error.

Function Wait()

Dim StartSecond
Dim EndSecond

StartSecond = Second(Now)
'Sheets("SampleOutputEx").Range("M2") = StartSecond

EndSecond = (StartSecond + 30) Mod 60                             
While Second(Now) <> EndSecond
  DoEvents
Wend

End Function
  • 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-16T05:09:23+00:00Added an answer on June 16, 2026 at 5:09 am

    Here we go. Never thought the answer could be very simple.

    Function Wait()
    Dim StartSecond As Single
    Dim EndSecond
    StartSecond = Now
    
    EndSecond = DateAdd("s", 30, Now)
    
    While Now < EndSecond
    DoEvents
    Wend
    
    End Function
    

    This works fine for me. Any comments regarding this are much appreciated.

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

Sidebar

Related Questions

I want to generate events that arrive with t seconds as mean inter-arrival delay?
I want to run a script every few seconds (4 or less) in google
I am trying to develop a application where-in I a want to generate a
I want to use JBoss tools in Eclipse to generate java code from DDL.
I want to use ASP.NET Application Services but configure it to use a different
How can I generate recurring dates using Python? For example I want to generate
I'm going crazy... I want to generate an array of tables that will need
I want to move some code that takes a couple seconds to generate a
Which checksum algorithm can you recommend in the following use case? I want to
This program will generate n-LIZARD threads and 1 CAT thread. Upon waking up the

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.