The program iterates through all of the operations in the part document. For every operation, it removes the override. It waits until all of them are done before invalidating the toolpaths. That way decomp() won't run each time. If decomp() runs each time, then the macro is very slow.
Sub main Dim oper As FMOperation For Each oper In ActiveDocument.Operations ' remove override oper.OverrideTool( "", False ) Next oper ActiveDocument.InvalidateToolpaths End Sub