I have a macro which is running from Excel. This macro opens PowerPoint slides, performs some work, and then closes them. The problem I am having is the following:
This error message appears seemingly randomly throughout the course of the macro's runtime. This error is not guardable with On Error GoTo Label and it seems that it is time dependent (based on some race condition), as at a later stage, again seemingly randomly, the line will run without issue.
The specific code which causes this error is as follows:
myPresentation.Close

Things I tested:
Which didn't fix the issue
Also didn't work. In the end the most stable solution I have come across is the following:
This utilises the library stdWindow - which is an open source library I maintain. Ultimately this sense the close message to the window indirectly (via the Windows API) which seems to be more stable, as I suppose this is exactly how users usually close windows.
It is important to note that setting saved appears to have some race condition, hence the loop.