reb_bl
Guest
hi, in vba I am trying (for now without outcome) to let the material of the part select from a combobox put in a form to have everything grouped and save time and click.
materials are in a custom bookcase, but I doubt that is the problem.
thanks to who will help me
materials are in a custom bookcase, but I doubt that is the problem.
Code:
public sub combomat_change()
' set a reference to the materials collection.
dim omaterials as materials
set omaterials = odoc.materials
dim omaterial as material
' get the selected item
dim omaterialname as string
omaterialname = combomat.listitem(combomat.listindex)
' set a reference to the active part document
dim odoc as partdocument
set odoc = thisapplication.activedocument
dim opartcompdef as partcomponentdefinition
set opartcompdef = odoc.componentdefinition
' get the selected material
dim omaterial as material
set omaterial = odoc.materials.item(omaterialname)
' change the part material
opartcompdef.material = omaterial
end sub
