Hi all
I have a macro that I launch via an Excel nomenclature. It allows me to modify the properties of parts and assemblies and to save plans in PDF and DXF as well as parts in STEP to prepare my manufacturing files. I would like to point out that when running the macro, you don't see SolidWorks open or the parts/planes open and close.
But here's the thing, my problem is that we are working with the 2022 version and one of our customers is working with the 2021 version and installing a working environment for their version of SolidWorks on our workstations.
So my question is the following: can we choose from Excel which version of SolidWorks to open (I would do this via a UserForm I think)? My knowledge of VBA is limited, everything I've done so far I've done by picking right and left on the internet. For the part of code specific to SolidWorks commands (the part modifying properties is not quite finished yet, I don't put it below):
Opening SolidWorks:
Set SWAPP = CreateObject("SldWorks.Application")
Opening and recording of the piece in STEP:
Set SWMODEL = SWAPP. OpenDoc6(CHEMIN_PIECE, 1, 1, "", myError, myWarning)
SWMODEL. SaveAs2 FLD_LANCEMENT_TEMPO & CHEMIN_STEP, 0, True, False
Opening and saving the plan in PDF and DXF:
Set SWMODEL = SWAPP. OpenDoc6(CHEMIN_PLAN, 3, swOpenDocOptions_Silent, "", myError, myWarning)
SWMODEL. SaveAs2 FLD_LANCEMENT_TEMPO & CHEMIN_PDF, 0, True, False
SWMODEL. SaveAs2 FLD_LANCEMENT_TEMPO & CHEMIN_DXF, 0, True, False
Closing open documents:
SWAPP. CloseAllDocuments True
Set SWAPP = Nothing: Set SWMODEL = Nothing
Can we instead of the "Set SWAPP = CreateObject("SldWorks.Application")" have a line of code that allows you to open the desired version?
Thank you for your help =)