Code: Select all
MsgBox About to reload Reload FileAppend , After reload , Debug.txt return
The documentation should mention that execution will continue after the Reload command for an unpredictable amount of time, which appears to be the time until the new instance of the script happens to shut down the current instance.
A separate issue is that if the Reload fails, then we need to put some code afterwards to handle it. An obvious choice is to ExitApp, but we can't do that because it triggers the OnExit routine, which could be interrupted by the new instance forcing shutdown of the current instance. We could sleep for a few seconds to give it some time, but even that doesn't guarantee it won't be interrupted, as the new instance might be delayed for a few seconds due to busy system or antivirus waiting for user prompt to allow the new instance. So all we can do after Reload is Exit or Return, which leaves the script running if Reload failed, which may be undesirable.