![]() It is cumbersome compared to the previous two options, but less so if you wrap it into an easy to remember and use procedure. However, you will be able to execute Public sub procedures from the Developer menu of the xlRibbon. While active, you can do normal sheet and cell operations, but you will not be able to execute additional code directly from the Visual Basic Editor. Private Declare PtrSafe Function GetTickCount Lib "kernel32" () As Long Instead of putting the process that the Office application is running on to sleep, it calls the CPU clock counter directly using another API call: ' Returns the amount of milliseconds that have elapsed since Windows was started: Within the loop, DoEvents is called to allow keyboard and mouse events to occur normally. Personally, I have never encountered a real-world scenario where I needed to use this method, but it exists: Public Function WaitAsync(numberOfSeconds As Long)Īpplication.EnableCancelKey = xlErrorHandlerĮndTick = GetTickCount + (numberOfSeconds * 1000) ![]() Demo Resultįor this method, accuracy improves by a factor of ~10 over the Excel-based functions: The key cannot be used to break out of Sleep.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |