Search code examples
vbacatia

Accessing User Defined Properties in CATIA using VBA code


I'm looking to access user added properties using code similar to properties that the program auto-generates and using the .selection command to make it work.

The code to access the computer properties is '''CATIA.ActiveDocument.Selection.Item(1).Value.Name'''

I'm struggling and the best attempt I have towards accessing additional properties fields under the "Product: Added Properties" area: '''CATIA.ActiveDocument.Selection.UserRefProperties.Item("Properties\DESIGNER").Value'''


Solution

  • Your code works for me, but you have to be careful about the Name of the parameter you give to Item, otherwise, the method fails. I created a single Product called Product1, where I added a Property MINE : enter image description here

    Then in VBA I can access the parameter like that :

    product1.UserRefProperties.Item("Product1\Properties\MINE")
    

    enter image description here