Stop and Wait While Executing VBA CodeThis programs stops and waits for a few seconds in the middle of the execution of the VBA code.
ExplanationSometimes it is useful to stop the coding for a few seconds due to processes that needs to be finalized that are not directly connected and in interaction with the VBA engine, thus will make the program crash if they are not finalized before executing the rest of the VBA program. For example if you have a program that you can execute through VBA macro but it is not fully integrated with excel thus you do not know when the other program has performed their processes. But you might know that the maximum time for finish is 10 seconds then you simply stop your VBA code for 10 seconds and then you can continue the code again! An example file of the code is possible to download at the end of this web site, enjoy! Or just copy and paste the code directly from this page.
CodePublic Sub
‘Stops the execution of the code and continues after 10 seconds. Application.Wait Now + TimeValue("00:00:10")
End sub
Download excel file! Stop_and_Wait_While_Executing_VBA_Code.xls |