Community
Public Sub InsertCustomPartinPartlist() Dim oDoc As Document Dim oSheet As Sheet Dim oPartslist As PartsList Set oDoc = ThisApplication.ActiveDocument If oDoc.DocumentType = kDrawingDocumentObject Then Set oSheet = oDoc.ActiveSheet oSheet.Activate Set oPartslist = oSheet.PartsLists(1) Dim oPartslistRows As PartsListRows Set oPartslistRows = oPartslist.PartsListRows.Add Dim oPartslistCell As PartsListCell Set oPartslistCell = oPartslistRows.Item Else MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name" Exit Sub End If End Sub
Hi,
Im planning to add custom part in my idw partslist. Also want to add values for the added custom part. I tried but unable to select the last added item. Can anybody help?
-karthikeyan
Solved! Go to Solution.
Hi Karthik,
I've modified your Code slightly which might help you
Public Sub InsertCustomPartinPartlist() Dim oDoc As Document Dim oSheet As Sheet Dim oPartslist As PartsList Set oDoc = ThisApplication.ActiveDocument If oDoc.DocumentType = kDrawingDocumentObject Then Set oSheet = oDoc.ActiveSheet oSheet.Activate Set oPartslist = oSheet.PartsLists(1) Dim oPartslistRows As PartsListRows Dim oCount As Long oCount = oPartslist.PartsListRows.Count+1 oPartslist.PartsListRows.Add oPartslist.PartsListRows.Item(oCount).Item(2).Value = 2 'Qty oPartslist.PartsListRows.Item(oCount).Item(3).Value = "Part Number" oPartslist.PartsListRows.Item(oCount).Item(4).Value = "Description" 'You Can Add N number of columns you have Else MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name" Exit Sub End If End Sub
Can't find what you're looking for? Ask the community or share your knowledge.