API two version of Solidworks on PC

Hello

 

Yesterday we installed the 2020 version of Solidworks but a server problem and changing licenses made us stay on our Solidworks 2018.

 

So we end up with 2 versions of Solidworks on our PCs, one newer and one older that we use. I have a macro that uses the 'Set swApp = GetObject(, "sldworks.application")' but it doesn't work anymore.

 

I think with the installation of the 2020 version it is looking for the most recent application, is there a way to specify Solidworks 2018? 

Do you launch your macro from SW or from Excel or another way?

If it's from SW try to modify your code by this (without being convinced)

Dim swApp       As SldWorks.SldWorks

Set swApp = Application.SldWorks

Instead of:

Set swApp = GetObject(, "sldworks.application")

 

Or another solution:

Maybe by changing in windows on the file type with which SW they open.

1 Like

I launch the Macro from Solidworks but it goes to excel first and then comes back to work on solidworks (GetObject after my work on excel).

 

Your solution works perfectly I had:

Dim swApp As Object

Set swApp = GetObject(, "sldworks.application")

 

I don't know why I did it like that...

 

Thank you!!