- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So, I have come upon this link which has the code that allows you to put an occurence description/number in a BOM Balloon call out. It works great. What I haven't been able to find is a way to take those occurences and put them in a table or parts list. Has anyone ever attemped this? I have attached a picture of what I am trying to accomplish. The table shown was created by "brute force". I even found code which allows for the creation of a custom table on the fly, but I lack the VBA knowledge to be able to tell the table to put the "Occurence Tracking" data (shown as sensor description in the table in the image) in the correct column.
Here's what I have so far for the Table Creation.
Public Sub CreateCustomTable()
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
' Set a reference to the active sheet.
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
' Set the column titles
Dim oTitles(1 To 2) As String
oTitles(1) = "Part Number"
oTitles(2) = "Sensor Description"
' Set the contents of the custom table (contents are set row-wise)
Dim oContents(1 To 16) As String
oContents(1) = "FS-N11CP"
oContents(2) = "Bowl Part In Place"
oContents(3) = "FS-N11CP"
oContents(4) = "Bowl Part In Place"
oContents(5) = "OISP-014"
oContents(6) = "Gripper Rotary 180°"
oContents(7) = "OISP-014"
oContents(8) = "Gripper Rotary Home"
oContents(9) = "D-M9PVSAPC"
oContents(10) = "Gripper Open"
oContents(11) = "D-M9PVSAPC"
oContents(12) = "Gripper Closed"
oContents(13) = "D-M9PSAPC"
oContents(14) = "Gripper @ Home"
oContents(15) = "D-M9PSAPC"
oContents(16) = "Gripper @ Pick"
' Set the column widths (defaults to the column title width if not specified)
Dim oColumnWidths(1 To 2) As Double
oColumnWidths(1) = 5
oColumnWidths(2) = 8
' Create the custom table
Dim oCustomTable As CustomTables
Set oCustomTable = oSheet.CustomTables.Add("Input Locations & Descriptions", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
2, 8, oTitles, oContents, oColumnWidths)
' Where "_2" is the number of columns and "8" is the number of rows
' Change the 3rd column to be left justified.
oCustomTable.Columns.Item(3).ValueHorizontalJustification = kAlignTextLeft
' Create a table format object
Dim oFormat As TableFormat
Set oFormat = oSheet.CustomTables.CreateTableFormat
' Set inside line color to red.
oFormat.InsideLineColor = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
' Set outside line weight.
oFormat.OutsideLineWeight = 0.1
' Modify the table formats
oCustomTable.OverrideFormat = oFormat
End Sub
Solved! Go to Solution.