![]() The second part of this introduction is dedicated to exploring how the DoEvents function affects performance. This is logical, since, by yielding execution to other events and processes, Excel temporarily halts the code execution while the operating system handles these other events or processes. The DoEvents function in VBA is no exception since it will cause the execution time of your program to increase. ![]() However, as the saying goes, all good things come with a price. ![]() In the first part of this tutorial, we’ll show you how to circumvent this and other similar problems by using the VBA DoEvents function. We’ve all made a mistake in a code which causes an infinite loop or something Your program will, in theory, never terminate and Excel will remain unresponsive until you shut down your Excel application! So frustrating. Only few things in life are more frustrating than trying the halt the execution of a program and not being able to because Excel has become unresponsive. The VBA DoEvents function also enables interruption of code execution so it’s easier to stop a running macro. VBA DoEvents yields execution of your macro, so your computer processor will be able to simultaneously run other tasks and recognize other events.
0 Comments
Leave a Reply. |