I've hit a snag, I've been on this for a week now and continue to get to the same problem. I'm using CATIA V5R26 and I'm attempting to change user defined properties (Define Other Properties) through selecting a product/part in CATIA and running a macro.
Currently, this is what I have
Set Pull_document2 = CATIA.ActiveDocument.Selection
Part_Number_Name = Pull_document2.Item(1).LeafProduct.ReferenceProduct.Name
CATIA.ActiveDocument.Selection.Item(1).LeafProduct.ReferenceProduct.UserRefProperties.Item(Part_Number_Name & "\Properties\DESIGNER").Value = "Yeet"
This yields 2 problems, I still am unable to change level 2 or further attributes. This only works on the top level. Additionally, there are 11 user defined properties I'm attempting to manipulate and the code will only do 3. I've tried a lot of different routes and also used other peoples code that they use and for some reason it doesn't work.
What needs to be done to allow this to work on multiple levels? Why would this only be able to change 3 of the 11 user defined properties?
One problem is that you are basing this off of a selection. If the user selects the wrong type of object it's going to throw an error.
That said, try this:
Set Pull_document2 = CATIA.ActiveDocument.Selection
Set ProducRef = Pull_document2.Item(1).LeafProduct.ReferenceProduct
With ProducRef.UserRefProperties
.Item("DESIGNER").Value = "Yeet" ' This is how I think it should work
.Item(.Name & "\Properties\DESIGNER").Value = "Yeet" ' This is based on the code you had
End With
Inside that With block you should be able to list out all the properties you want to change.