I have 2 versions of Solidworks installed on my PC.
How can I open a specific version using API?
Thanks in advance.
SolidWorks has to be open already for you to use the API so you would need to open SLDWORKS.exe via some other method, like the Shell command in the case of VBA and System.Diagnostics.Process.Start in the case of .NET. Someone can correct me if they know of a better way. Anyway, with either of those functions you will need to point to the appropriate .exe so you can control which version is opened by the path you input.
Of course, if you wanted to open up one version while the other version is open, then that is certainly possible using the above techniques.
Video Tutorials for the SolidWorks API
force use of sw2010
Set swApp = CreateObject("SldWorks.Application.18")
or if sw already running
Set swApp = GetObject(, "SldWorks.Application.18")
sw2011 = “SldWorks.Application.19” etc.
Retrieving data ...