' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("XXXXX_630S_dechargement_de_650_tendeur_standard-1@xxxxx/63_ensemble_tendeur_palier_(01)-3@XXXXX_630S_dechargement_de_650_tendeur_standard", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
boolstatus = Part.CompConfigProperties4(2, 0, True, True, "Sans moteur", False, False)
Part.ClearSelection2 True
boolstatus = Part.EditRebuild3()
End Sub
The problem is that when I restart this macro it doesn't work, I get an error
"execution error '450'"
Invalid number of arguments or incorrect property assignment
Yes it's weird, when I do the Solidworks macro recorder comes out almost the same macro as you but by putting "CompConfigProperties5" and not "CompConfigProperties4" and then it works since "CompConfigProperties5" has one more argument.
And normally, from the 2019 version of SW, it would be cleaner to take the "CompConfigProperties6" function which still has one more argument...
FYI, the "CompConfigProperties5" function appeared from the 2017 version, it would be interesting to know the evolutions you have followed in the successive installations of Solidworks and if you reinstall the VSTA option each time...
Yes, it's normal that it offers you the "CompConfigProperties4" function but it's weird that it puts one too many arguments in it suddenly!!
This means that this is a point to check on macros coming out of the recorder but as remrem said, "In most cases, even simple, macro recording is not enough.", this is just a help to start macros.