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


excel vba range resizeexcel 2007 vlookup tutorialvba listbox additemexcel 2013 developer tabexcel tutorial pivot tablesswitch between sheets excel shortcutexcel widget dashboardexcel hide buttonstart vba in excelremove duplicate in excelexcel difference between two dates in monthssort excel vbaexcel worksheet objecthow to send email using vbaascending & descending order worksheetsvba excel msgboxmacro to consolidate data from multiple worksheetswriting excel macrowriting vba functionspivot table wizard excel 2010excel formulas for averagegantt chart in excel 2003delete blank rows in excelexcel macro msgboxworksheet or workbookautofit excel vbatutorial excel vlookupribbon tab in exceltask management tools excelvlookup in vbadelete duplicate values in excelvba programmingremove zeros in excelhow to protect excel sheet with passwordcheckbox in vbamaximum number of sheets in excel 2007change the width of column in exceltimeline excel templateexcel conditional vlookupcopyfromrecordset vbawindows excel shortcutscase statement in vbaunlocking an excel spreadsheetexcel macro rangecheckbox in vbaaccess vba programming pdfwhere to find developer tab in excel 2007remove duplicate in excel 2003excel vba arrayexcel formulas shortcut keys 2007excel cell rangesmerge duplicate rows in excel 2010sumifs vbaopen recordset vbavba outlook folderblank gantt chart templatevba worksheet deleteexcel hide rowhyperlinking in excelif isna formularesource allocation template excel freemicrosoft excel 2010 developer tabmerge 2 columns in excel 2010how to use concatenate function in excel 2010unprotect excel 2010macro filter excelvba coding tutorialexcel formula to identify duplicatesexcel sort column alphabeticallyexcel macro display messagewhat are dml statementshidden columns in excel