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


microsoft excel charts tutorialvba application.getopenfilenameexcel as database vbafunction vba excelexcel formula with example in hindivba excel advanced tutorialvlookup and hlookup in excel 2010to remove duplicates in excelsort excel spreadsheet by columnconversion of xml file to excelusing the sumif functionhow to sort numbers in excel in ascending orderhow to delete an array in excelexcel unhide workbookexcel macro hide columnsvlookup excel functionexcel vba usedrangecase statement in vbahlookup example in excelvbcrlf in vbaexcel vba cell addressmicrosoft excel tables tutorialhow to remove the duplicates in excelvba excel last rowexcel to kml macrowhat is excel vba programmingexcel 2010 data validation listhow to remove a checkbox in excelvba create new foldertrim command in excelexcel programming samplesexcel copy sheet to another workbookdeclaring variables in vbaexcel vba codehow do you use vlookup in excel 2010project portfolio template exceluseful vbs scriptsexcel vba eventsvba combobox control sourceexcel vba rgbcreate check box in excelsas eg tutorialmicrosoft excel unprotect sheetrow vbahow to join cells in excelnutshell tutorialmsofiledialogfilepickerexcel count formulashow do you protect an excel spreadsheetvertical lookup excel 2007how to learn macrospivot table vba excelunprotect worksheet forgot passworddelete blanks excelvlookup tutorial 2010excel construction estimate templategenerate graph in excelexcel 2003 vbaexcel 2010 unhide rowsremove duplicate rows in excelview hidden tabs in excelforgot excel workbook passwordmsgbox example vbaleft vlookupexcel dashboards templateslast cell excelsql dml statementshow to select entire column in excelhow to use hlookupexcel vba create tablecharter template project managementvba excel tricksactivate developer tab in excel 2010excel formula if cell contains text thenmacro learning in excelexcel delete duplicateshow to unhide the rows in excelconsolidate in exceladvanced filter in excel 2010excel substitute exampleexcel vba select row