Get Custom Properties for BOM Table Columns Example (VBA)
This example shows how to get the custom properties used to fill columns
in a BOM table.
'----------------------------------------------------
'
' Preconditions: Drawing document with BOM table is open.
'
' Postconditions: None
'
'----------------------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swTable As
SldWorks.TableAnnotation
Dim
swBomTable As
SldWorks.BomTableAnnotation
Dim
i As
Long
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swTable = swSelMgr.GetSelectedObject5(1)
Set
swBomTable = swTable
Debug.Print
"File = " & swModel.GetPathName
For
i = 0 To swTable.ColumnCount
Debug.Print
" Column("
& i & ") = " & swBomTable.GetColumnCustomProperty(i)
Next
i
End Sub
'----------------------------------------------------