I just closed a stack of about 25 or more that had the same error being reported.
In this case the error was: ObjectAction statement can only be used in a form window. This was in spite of the active window is a form and has the targeted object. The actual error was that I went to the Desktop while the procedure was running. If Panorama isn’t the active app, the error occurs for me in a number of places.
I’ve tried to discipline myself and the client to not touch anything when we have any one of several involved procedures running. These procedures are reliable if we control ourselves, but are just as reliable at failing if we click on anything.
I have been applying Gary’s suggestion about magicwindow in ObjectAction error but it’s been a bit elusive to get it working in all scenarios.