Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code. I want it to show the total nummmer of each part/assembly what am I missing or doing wrong?
Class BOMEXport Shared Row2 As Integer = 3 Shared Stk Sub main() PossibleIssueReport() End Sub Sub PossibleIssueReport() Row2 =3 Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oBOM As BOM oBOM = oDoc.ComponentDefinition.BOM oBOM.StructuredViewEnabled = True oBOM.StructuredViewFirstLevelOnly = False oBOM.StructuredViewDelimiter = "." oBOM.PartsOnlyViewEnabled = True Dim oBOMView As BOMView oBOMView = oBOM.BOMViews.Item("Structured") debug("Call ExportToExcel") Call ExportToExcel(oBOMView.BOMRows) End Sub Public Sub debug(txt As String) Trace.WriteLine("NTI : " & txt) End Sub Public Function ExportToExcel(brows As BOMRowsEnumerator) Dim brow As BOMRow For Each brow In brows AssemblyFeature ="" Dim rDoc As Document rDoc = brow.ComponentDefinitions.Item(1).Document Dim docPropertySet As PropertySet docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties") Dim docPropertySet1 As PropertySet docPropertySet1 = rDoc.PropertySets.Item("User Defined Properties") Dim docPropertySet2 As PropertySet docPropertySet2 = rDoc.PropertySets.Item("User Defined Properties") Dim docPropertySet3 As PropertySet docPropertySet3 = rDoc.PropertySets.Item("User Defined Properties") 'item , part number, qty, description, G_L (Custom), Raw material, Status (Custom) 'debug(" what is the row number now " & Row) oHoleRepportExcel = oHoleRepportExcel & docPropertySet.Item("Part Number").Value & " " & docPropertySet.Item("Description").Value & " QTY " & docPropertySet3.Item("QTY").Value & vbLf Next MessageBox.Show(oHoleRepportExcel , "Title") End Function End Class
Solved! Go to Solution.