Wait Method of Application Object VBA

Wait Application Method in VBA is used to pauses or stop a running macro until a specified or mentioned time. It returns a Boolean value either true or false. If the specified time arrived, it returns true otherwise it returns False.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


VBA Wait Application Method – Syntax

Here syntax for Wait method of application object in VBA.

Application.Wait(Time)

Where
Time: It is a required parameter. It specifies the time at what time you want to resume the macro.
In the above syntax Application represents object and Wait is the method of Application of Application object.

VBA Wait Application Method: Example 1

Please find the below example for Wait method of application object in excel VBA.
Application. The below macro Pauses an application till 4.00 PM today.

Sub Appl_Wait1()
Application.Wait "16:00:00"
End Sub

VBA Wait Application Method: Example 2

Please find the below example for Wait method of application object in excel VBA.
Application. The below macro Pauses an application for 20 seconds from now.

Sub Appl_Wait2()
Application.Wait Now + TimeValue("00:00:20")
End Sub

VBA Wait Application Method: Example 3

Please find the below example for Wait method of application object in excel VBA.
‘Display message after 60 seconds.The below macro displays a message like “Your session has expired”
after 60 seconds or 1 hour.

Sub Appl_Wait3()
If Application.Wait(Now + TimeValue("0:00:60")) Then
MsgBox "Your session has expired"
End If
End Sub

VBA Wait Application Method – Instructions

Please follow the below steps to execute the VBA code to save the excel file.
Step 1: Open any existing Excel Application.
Step 2: Press Alt+F11 – This will open the VBA Editor.
Step 3: Insert a code module from then insert menu.
Step 4: Copy the above code and paste in the code module which have inserted in the above step.
Step 5: Now press F5 to execute the code.
Step 6: First time run the macro in debug mode (Press F8) to observe the Wait macro result.

LIMITED TIME OFFER

Leave A Comment


Related pages


vba range selectexcel scripting tutorialpowerpoint dashboard templatedelete macro excelexcel shortcut select rowwhat is a pivot table in excel 2013excel vba read xml filesurface plots in excelcall function in vbahow to remove duplicate rows in excelhow to do a hard return in excelunhide cellvba save excel filefreshers interview questions and answers pdfsql dml commands with examplesnutshell tabsgantt charts in excel 2007microsoft excel duplicate findercreate userform in excel vba using codedefinition of rows in excelexcel formula to highlight duplicatesexcel vba collectionexcel 2010 match functionhow to delete odd rows in excelvba case functionvba in excel exampleshow to delete empty rows in excelexcel vba close fileexcel macro paste valuesexcel checkbox valuewhat is vlook up in excelexcel 2007 lock cellsexcel vba create formcombine multiple cells in excelexcel macro open excel filevba excel active cellpivot table excel tutorial 2010vba excel cells.findfso.fileexistshow to merge cells excel 2013lookup and reference in excelexcel import worksheetdml and ddl in sql serverhow to insert multiple rows in excel 2007stacked bar graph excel 2010what is the match function in excelvba find last row with dataexcel consolidate columnscreating an if statement in excelaccess vba if then elsevba msgbox next lineunhide tabs in exceloption button excelmsgbox excel vbasql interview questions for freshers pdfhow do you merge cells on excelbasic vba commandsvba sub procedureselect case statement vbacreate input form in excel 2010excel vba form controlsexcel vba cell containspivot table basicsautomation testing interview questions and answers pdf free downloadexcel macros basicsvlookup excel examplesexcel 2007 dashboard tutorialvba excel range cellscontoh minutes of meetingmacro excel definitionexcel application.getopenfilenamevba excel basicsddl commands in sqlshortcut key in excel