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?
if swapp is nothing.....
if swapp is nothing.....
All the "good" news about SWX makes me feel like I'm driving a truck with two trailers straight into a dead end.
Re: if swapp is nothing.....
Maybe it crashed before completing? Otherwise, I have no idea there.
Re: if swapp is nothing.....
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.
-
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
I may not have gone where I intended to go, but I think I have ended up where I needed to be. -Douglas Adams
- AlexLachance
- Posts: 2179
- Joined: Thu Mar 11, 2021 8:14 am
- Location: Quebec
- x 2356
- x 2011
Re: if swapp is nothing.....
swp is not strictly prohibited to SolidWorks, but I'm not sure why one would try to run the macro anywhere else then SW
Re: if swapp is nothing.....
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.