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


what are vlookups in excelisna function in excelhow to apply vlookup formula in excelexcel vba activeworkbookvlookup excel worksheetsample excel spreadsheet templateschart types in excelexcel vba insert multiple rowshow to loop in vbavlookup formula with if conditionexcel vba reference cellexcel enable macroexcel create macrosvba excel lefthow to lock an excel spreadsheethow to delete empty rows in excelvba entire row deleteexcel cost analysis templatesql questions and answers pdfdynamic filter excelconcatenate in excel 2010excel project dashboardcountif function on excelkpi dashboard excel templatesvba sheet activatedocmd.runsql deletecase is vbaduplicate finder in excelgantt charts in excel 2007creating a check box in excelcreating an if statement in excelfresher interview questions and answersunprotecting excel sheetsort worksheets alphabeticallysample vb programs for beginnersunlock excel spreadsheetunhide cellsproject planning gantt chart excelexcel countif rangevba excel saveasexcel formula not blankvba code for excelvba with accessexcel macro format cellrun a macro in excel 2007remove duplicates from excel listexcel macro data validationexcel table pivottutorial excel macrosproject management dashboard excel templateexcel vba functions tutorialexcel vba macroexcel delete cellsaccess vba open excel workbookexcel data from another workbookvba coding examplesexcel vba delete pivot tableaccess vba odbc connection string sql serversample project timelinesdynamic array vbaupdate vba accessvba clearcontentshow to unlock excel protected sheetformula excel countifwhere is autofit in excel 2013how to lock an excel documentvba subroutinesexcel hiding columnsproject tracking template excelprotecting a workbook in excelmeeting minutes template microsoft wordto remove duplicates in excelhow to add developer tab in excel