In my program I'm calling a sub routine in order to download a couple of files which can take some time. My program should not proceed until every file has been fully downloaded. Is there an effective way to 'pause' the current activity until the sub routine has reached 'end sub'?
which I hide at the end of the sub, while at the same time (at the end of the sub) I continue by calling a new sub containing the rest of components I wish to load. You can also experiment with a boolean flag set to true, by looping until the sub is finished. But I don't know if this may cause unwanted behavior (a crash for e.g.).
You cannot pause the main thread. Holding it in an endless loop will also not work as the events will not be processed (even if you call DoEvents, as DoEvents only processes UI messages).