Using the Excel VBA Wait command

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Topics » Using the Excel VBA Wait command

Using the Excel VBA Wait command

The Excel VBA Wait command is an instruction that can be used to delay the running of a macro.

The command is written as:
expression.Wait(Time)

e.g. This example pauses a running macro until 6:23 P.M. today.

Application.Wait "18:23:00"

or

This example displays a message indicating whether 10 seconds have passed.

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Time expired"
End If

It can be used in a HR or Financial function to have a front splash screen(logo) and after a delay, the main form appears.

After running a routine, you may want a message box to appear outlining the next instruction.

Related forum posts:

Excel VBA: how to use the "Wait" command

I understand the command - [b]Application.Wait Now + TimeValue("00:00:01")[/b] is to pause the macro for 1 second before execution. But it only pauses at the beginning of the macro and not within. How do I manipulate the line so it will pause in the middle of my macro. e.g. My Excel macro suppose to wait for the user to choose paper tray before printing. My code so far pauses for 5 seconds at the beginning before it executes... '''''''''''''''''''''''''''''''''

Read forum post

 

 

Training courses

 

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


Server loaded in 0.46 secs.