DoeEvents is not synonymous with Sleep(0). They have different behaviour. DoEvents is synchronous and pumps the message loop before proceeding with the following code. Sleep(0) is asynchronous and returns from the Sub to the message loop immediately and the following code is scheduled to run at a later time.
Msgbox, DoEvents and other synchronous dialogs used a synchronous mechanism designed by Erel in the early days of Android as Android, by design unlike Windows, does not implement synchronous waits while letting the message loop run. Unfortunately over the years the Android message loop handling has become more complex and as a result Erel's synchronous mechanisms is now flaky - hence, Msgbox, DoEvents and all the synchronous dialogs are deprecated but available in case of need for backward compatibility.