Message 1 of 1
Import iProperties From Excel to Specific Part in .iam File

Not applicable
07-02-2019
09:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am still new to iLogic and I was wondering if this is even possible. I have created a rule which allows me to fill out iProperties of whatever .ipt I have open from an excel fill. However, what I want is to apply a rule like this to a .iam which would allow me enter a specific part number, retrieve the information about that part number from the columns in excel, and then have the iproperties to that specific part within the assembly be filled out. I will attach the code I have that works on an .ipt file
'Define excel file variables Dim BOM_path As String = "C:\LSE Vault\Data\iProperties_new.xlsx" Dim osheetbom As String = "Sheet1" 'ensure correct file is active xlApp = CreateObject("Excel.Application") xlApp.Visible = True xlWorkbook = xlApp.Workbooks.Open(bom_path) xlWorksheet = xlWorkbook.Worksheets.Item(osheetbom) 'prompt user for part number part_number = InputBox("Plese enter the part number", "Get Data") 'Cancel test If part_number = "" Then MsgBox("Please enter a Valid Part Number", , "No Part Numbered Entered") Return End If 'declares conditional statement // searches through part numbers Dim j As Integer = 1 Line1 : oTest = xlWorksheet.Range("A" & j).Value If oTest <> "" Then j = j + 1 GoTo Line1 End If 'locates entered part number and pulls information For row = 2 To j If xlWorksheet.Range("A" & Row).Value = part_number Then iProperties.Value("Project", "Part Number") = xlWorksheet.Range("A" & Row).Value iProperties.Value("Project", "Description") = xlWorksheet.Range("B" & Row).Value iProperties.Value("Project", "Project") = xlWorksheet.Range("C" & Row).Value iProperties.Value("Summary", "Title") = xlWorksheet.Range("D" & Row).Value MessageBox.Show("All properties have been applied", "Success") End If Next xlWorkbook.Close (True) xlApp.Quit