Keep macro active after switching part/assembly

After I switch part/assembly, the macro becomes inactive andI have to restart the marcro again
How to keep it active after switching part/assembly
Thx, ChrisSolidworksApi macros