
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi , i am trying to export a BOM from Inventor 2017 using this code, but i get 3 errors.
1) I can't disable the FirstlevelOnly option i get "Invalid procedure call or argument", so i am forced to make this line a comment.
2) The same thing happens with the selection of the Structured type of View. so i change the code with "Set oStructuredBOMView = oBOM.BOMViews.Item(1).
3) With the corrections mentioned above , the last line gives me an error of type " Object doesn´t support this action"
Please help me correct the error or find a new solution .
Thank you
Public Sub BOMAllLevelExport()
' Set a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
' Set a reference to the BOM
Dim oBOM As BOM
Set oBOM = oDoc.ComponentDefinition.BOM
' Set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False
' Make sure that the structured view is enabled.
oBOM.StructuredViewEnabled = True
' Set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView
Set oStructuredBOMView = oBOM.BOMViews.Item("Structured")
' Export the BOM view to an Excel file
oStructuredBOMView.Export ThisApplication.FileLocations.Workspace & "\BOM.xls", kMicrosoftExcelFormat
End Sub
Solved! Go to Solution.