read from Excel, paste to iprop, but don't overwrite if the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I Have cobbled some code together that reads from an Excel spreadsheet and populates the contents as Iproperties in inventor. the spreadsheet has many rows that start off with a tag number. from the tag the other properties are found and written to Inventor.
Everything is working fine but I would like the code to check it the vault is the same then don't over ride.
I don't want the code dirtying all the files that don't need updating.
Dim odoc = ThisDoc.Document Dim oXLfile As String = ThisDoc.Path & "\Data.xlsx" Dim oSheet As String = "Export" Dim oPartNumber As String = iProperties.Value("Project", "Part Number") GoExcel.Open(oXLfile, oSheet) GoExcel.FindRowStart = 2 i = GoExcel.FindRow(oXLfile, oSheet, "Tag Name", "=", oPartNumber) o3DObjectMaturity = GoExcel.CurrentRowValue("3D Object Maturity") oActivityCode = GoExcel.CurrentRowValue("Activity Code") oAreaCode = GoExcel.CurrentRowValue("Area Code") oDryWeight = GoExcel.CurrentRowValue("Dry Weight") oEngineeringObjectMaturity = GoExcel.CurrentRowValue("Engineering Object Maturity") If i <= 0 Then MessageBox.Show("Item is not in spreadsheet", "Warning") Else iProperties.Value("custom", "3D Object Maturity") = o3DObjectMaturity iProperties.Value("custom", "Activity Code") = oActivityCode iProperties.Value("custom", "Area Code") = oAreaCode iProperties.Value("custom", "Dry Weight") = oDryWeight iProperties.Value("custom", "Engineering Object Maturity") = oEngineeringObjectMaturity MessageBox.Show("MetaData from Engineering data has been updated", "Update Notice") End If GoExcel.Close 'iLogicVb.UpdateWhenDone = True 'ThisDoc.Save
Regards,
Warren.