Read Excel sheet into iProperties, then BOM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Long story shorter, I am not an Inventor user. This is done per the request of a co-worker who uses Inventor (2019). He wants to me write some code to compare an iProperty "Stock Number" to an excel sheet, with a column A "Purchased Item". These two (Part Number and Purchased Item) contain the exact same information. What I need to do is compare both of these values, and if they match, pull from Column B "Internal Part Number" and import it into inventor as a new custom column in the BOM.
What I have so far as far as code, is to pull the values from the Excel sheet, and import them as a new iProperty, but for some reason, it only populates the iProperty for the overall Assembly, not the Part files . I was using this as a starting point, since I was unsure if you could directly affect the BOM. From my limited knowledge of how this software works, I assume the BOM pulls data from each individual part, so I figured if I updated the iProperties of the parts, I could go from there and pull them into the BOM.
Dim oProj As String Dim oSheet As String oProj = iProperties.Value("Project", "Stock Number") GoExcel.Open("C:\Users\PATHHERE","EXCELSHEETNAME") For rowPR = 2 To 2000 If (GoExcel.CellValue("A" & rowPR) = oProj) Then oSheet = GoExcel.CellValue("B" & rowPR) iProperties.Value("Custom", "Internal Part Number") = oSheet Exit For End If Next GoExcel.Close