Message 1 of 2
Inventor VBA BOM sorting issue with custom order "Array"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using Inventor VBA to sort a Bill of Materials (BOM) based on a custom order defined in my VBA code. I have created an array with the desired order of the BOM items and I am using the oBOMView.Sort method to sort the BOM based on the CS_Description field and the custom order.
currently, I got an error and am not able to figure out how to solve it. the below line has "type mismatch" error.
Call oBOMView.Sort(Array("CS_Description", "CustomOrder"), Array(True, True), sortOrder)
the rest of the section is below. I am trying to use the array.
Dim oBOM As BOM
Dim oBOMView As BOMView
Set oBOMView = oBOM.BOMViews.Item("Structured")
Dim sortOrder(12) As String
sortOrder(0) = "description 1"
sortOrder(1) = "description 2"
sortOrder(2) = "description 3"
sortOrder(3) = "description 4"
sortOrder(4) = "description 5"
sortOrder(5) = "description 6"
sortOrder(6) = "description 7"
sortOrder(7) = "description 8"
sortOrder(8) = "description 9"
sortOrder(9) = "description 10"
sortOrder(10) = "description 11"
sortOrder(11) = "description 12"
'CS_Description is my custom property.
Call oBOMView.Sort(Array("CS_Description", "CustomOrder"), Array(True, True), sortOrder)
Call oBOMView.Renumber(1, 1)