Try these codes
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim vConfNameArr As Variant
Dim i As Long
Dim swConfig As SldWorks.Configuration
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
vConfNameArr = swModel.GetConfigurationNames
For i = 0 To UBound(vConfNameArr)
Set swConfig = swModel.GetConfigurationByName(vConfNameArr(i))
swConfig.Name = Left(swModel.GetTitle, 9) & Right(swConfig.Name, 3)
Thank you very much for your extreme reactivity, it works perfectly !
I take the opportunity to ask an other question.
After renaming the configurations, we would like to have a macro to change the old drawing name using the new configuration name (or create a new .slddrw file). The drawing name is always the same that the configuration name. If we have 4 configurations for the part, we will have 4 drawings named : XXXX_XXXX_00, XXXX_XXXX_01, XXXX_XXXX_02, XXXX_XXXX_03, XXXX_XXXX_04.
To make it easier, I think it's better to do a function like "save as" and delete manually from windows explorer the old drawings.
Thank a lot,
Yes it can be done but you need to ensure that drawings are linked to the renamed part.
Yes, this is the only work we can't automatise easily. Maybe with an Excel list but I think it's a lot of work to write the code. We do on each part from Windows Explorer a right-click -> SolidWorks -> Rename to keep the drawings linked.