I get errors right off the bat since I'm on Windows 10 64 bit and the kernel32.dll declaration blows up with a cryptic error message about LongPtr and 64 bit declarations
@seanmackenziedataengineering2 жыл бұрын
For 64-bit installations, you can try using: Private Declare PtrSafe Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long) Note PtrSafe added to the beginning of that line. It is for declarations in 64-bit Office installations.
@ValmisFilm2 жыл бұрын
how can I use Sleep over the whole workbook? At this point, I must add this declaration to each module.
@seanmackenziedataengineering2 жыл бұрын
Instead of Private Declare, try using Public Declare. Then you can call it from anywhere. You will need to delete the declaration from all other modules. Great question!
@ValmisFilm2 жыл бұрын
@@seanmackenziedataengineering Thank you! Like "Public Sub" - I just understood that all these years I did this one wrong :D
@kassemaubaid9217 Жыл бұрын
hello Sir MacKenzie.. I dont know for what we use sleep function
@seanmackenziedataengineering Жыл бұрын
Sometimes, you want to pause your code. Maybe you need to wait for some other external process to finish before your code can continue. Maybe your code triggers another process at the start of execution, then checks the result of that process at the end before you can continue. You know the process always takes 3 seconds to complete. So, you can start your code (which triggers the process) then sleep for 4 seconds before it consumes data from the external process (simple example and it assumes the process always takes 3 seconds).