how do I get date form BOM using Ilogic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sub main() Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oBOM As BOM oBOM = oDoc.ComponentDefinition.BOM oBOM.PartsOnlyViewEnabled = True Dim oBOMView As BOMView oBOMView = oBOM.BOMViews bRows = oBOMView.BOMRows Dim bRow As BOMRow For Each bRow In bRows 'Enter code here Next End Sub
I am trying to build an code that read data form BOM. I want to read
item , part number, qty, description, G_L (Custom), Raw material, Status (Custom)and add to an Excel .
but can´t get the for each to run .... I was trying to rewrite an VBA code I found on the net .. that I beleive would do almost what I want ..( see sample below)... any I did why it fail ... you are welcome to help with the rest of the code
'Public Sub Main() 'Dim oDoc As AssemblyDocument 'Set oDoc = ThisApplication.ActiveDocument 'Dim oBOM As BOM 'Set oBOM = oDoc.ComponentDefinition.BOM 'oBOM.PartsOnlyViewEnabled = True 'Dim oBOMView As BOMView 'Set oBOMView = oBOM.BOMViews.Item("Parts Only") 'Call ExportToExcel(oBOMView.BOMRows) 'End Sub 'Public Function ExportToExcel(bRows As BOMRowsEnumerator) 'Dim xlApp As Excel.Application 'Set xlApp = GetObject("", "Excel.Application.15") 'Dim xlWorkbook As Workbook 'Set xlWorkbook = xlApp.Workbooks.Open("C:\SolidCAD\Inventor Training Files\iLOGIC\Beam\Beam Assembly - BOM.xls") 'Dim xlWorksheet As WorkSheet 'Set xlWorksheet = xlWorkbook.Worksheets.Item("TEST") 'Dim row As Integer 'row = 5 'xlWorksheet.Range("B4").Value = "ITEM" 'xlWorksheet.Range("C4").Value = "QTY" 'xlWorksheet.Range("D4").Value = "DESC" 'xlWorksheet.Range("E4").Value = "Part Number" 'Dim bRow As BOMRow 'For Each bRow In bRows 'Dim rDoc As Document 'Set rDoc = bRow.ComponentDefinitions.Item(1).Document 'Dim docPropertySet As PropertySet 'Set docPropertySet = rDoc.PropertySets.Item("Design Tracking Properties") 'xlWorksheet.Range("B" & row).Value = bRow.ItemNumber 'xlWorksheet.Range("C" & row).Value = bRow.ItemQuantity 'xlWorksheet.Range("D" & row).Value = docPropertySet.Item("Description").Value 'xlWorksheet.Range("E" & row).Value = docPropertySet.Item("Part Number").Value 'row = row + 1 'Next 'xlWorkbook.Save 'xlWorkbook.Close (False) 'xlApp.Quit 'End Function