VBA for accessing and modifying user define iproperties with oBOM.BOMViews
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI,
I am trying to write a VBA as a test to access the 1st row of an assembly BOM. I wish to access iproperties through oBOM.BOMViews and then modify the value. I took reference from some examples on this forum and come up with a small piece of code. However, it is not working and I have no clue how read the User Define properties "Type" which is already defined in the part file. Thanks in advance
Public Sub BOM_dunc_test()
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oBOM As BOM
Set oBOM = oDoc.ComponentDefinition.BOM
oBOM.PartsOnlyViewEnabled = True
Dim oBOMView As BOMView
Set oBOMView = oBOM.BOMViews.Item("Parts Only")
Dim oBOMRows As BOMRowsEnumerator
Set oBOMRows = oBOMView.BOMRows
Dim oRow As BOMRow
Set oRow = oBOMRows.Item(1)
Dim oBOMRowDoc As ComponentDefinition
Set oBOMRowDoc = oRow.ComponentDefinitions(1)
Dim oType As String
Set oType = oROMRowDoc.PropertySets.Item("Inventor User Defined Properties").Item("Type").Value
End Sub