if swapp is nothing.....

hello all,

for a new macro project I searched the net for some code snippets.

In one of the references I have found a query whose sense I do not understand.

'check if application is open
if swapp is nothing then
msgbox “to execute the macro, swx must be open”

what the query checked i still understand, but does that make sense with a swp macro at all? can the case occur at all?

A macro in swp format can only be executed via the corresponding function in swx, as far as I know you can’t even run the macro editor without swx active, so starting the macro via the editor without swx active is also out of the question.
Why do i need this query then?

Maybe it crashed before completing? Otherwise, I have no idea there.

Since those files are VB6/VBA code, I assume it could be launched from other applications. I think you would have to put effort into making such a thing happen, but in theory it could be done.

swp is not strictly prohibited to SolidWorks, but I’m not sure why one would try to run the macro anywhere else then SW

Perfectly valid safety check. Not only does SW need to be running, but the code needs a valid SW application object. If that object (“swApp”) gets disconnected somehow, then all of the code will not run.