MechMachineMan, thank you for the reply.
As per your macro, I see macro checks if there is any Parts List present and if yes, then it goes through every Parts List on every sheet, then gets item value from BOM table (DrawingBOMRow), adds zeros to match "####" format and then assigns this value to Item value on Parts List (assuming Item is first column). My assumption is that "DrawingBOMRow" is BOM Row object. Am I correct? I still learn object model for Inventor. This is my second week with Inventor. I made macro that does this using values from Item column in Parts List, not using anything from BOM table. I use Supplier column to differentiate from purchased and manufactured components so I can assign different values for purchased parts (just Item value from Parts list) or Detail number from manufactured Part Number. It works perfect but issue with BOM ballon stops me from finishing what I wanted.
Here is the macro:
Public Sub ChangeDETColumValue()
' 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 first parts list on the active sheet.
' This assumes that a parts list is on the active sheet.
Dim oPartList As PartsList
Set oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
Dim oVendor As PartsListCell
Dim oPartNumber As PartsListCell
Dim oTest As PartsListCell
Dim oItem As PartsListCell
Dim invPartNumber As String
Dim invCharPosition As Integer
' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To oPartList.PartsListRows.Count
'Get value from PartNumber column
Set oPartNumber = oPartList.PartsListRows.Item(i).Item("NUMBER")
Set oItem = oPartList.PartsListRows.Item(i).Item("ITEM")
Set oTest = oPartList.PartsListRows.Item(i).Item("DET")
Set oVendor = oPartList.PartsListRows.Item(i).Item("SUPPLIER")
'find a specific part number
If oVendor.Value = "JBA" Then
invCharPosition = InStr(1, oPartNumber.Value, "-D")
invPartNumber = Mid(oPartNumber.Value, invCharPosition + 1, 4)
'write to the target cell
oTest.Value = invPartNumber
Else
Select Case CInt(oItem.Value)
Case Is < 10
oTest.Value = "000" & oItem.Value
Case Is < 100
oTest.Value = "00" & oItem.Value
Case Is < 1000
oTest.Value = "0" & oItem.Value
Case Else
oTest.Value = oItem.Value
End Select
End If
Next
End Sub