Start macro when I close file

Hello,

How do I start the macro when I close a soldiworksfile.

Or how do I automaticly run a macro when I'm opening Solidworks?

Kind regards,

Willie

SolidworksApi macros