I have a macro to assist users in placing drawing borders and filling in title blocks.
The macro works fine and I have checks in place to determine if the active draft file has changed when the user applies the data.
However, how should I handle the situation where the user has closed the draft file before closing the macro, or closed Solid Edge completely.
At the moment in the form closing event I call a 'Cleanup' routine that resets various parameters and releases all the objects.
If the user has already closed the file or Solid Edge do I still need to do this or do I simply close the form?
You would want to attach to the Application.ApplicationEvents and listen for the BeforeQuit event. You'll also want to attach to the DraftDocument.DocumentEvents and listen for the BeforeClose event.
There are various ways to attach to these events, some better than others. I'm actually working on a blog post with GitHub samples demonstrating event handling. If you'll reply with your programming language, I'll get you a snippet to get you going.
It was written in vb.net express 2008.
I could update it to 2013 if that's better as I have that installed now also.