
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can't I really can't figure it out...
I made a code that goes and look in an excel file. It finds the Stock Number in the column Stock_Number and adds the description of said material from the column Description_Materiau. (I joined the .xlsx file)
We have three computer working on drawings on the same server and this code works on 2 out of 3 computer.
The first error that pops up on the computer is:
Error in rule: DescriptionMateriau_iproperty_test, in document: TUNNEL.ipt
Exception from HRESULT: 0x800A03EC
and when you run the rule again it's:
GoExcel: Could not match the column title: "Stock_Number".
But if I paste the path of the .xlsx (the one used in the code) in the windows explorer of said computer, it will open. So the computer knows where to find the file and has access to it.
Here's the code:
SyntaxEditor Code Snippet
'set the target document oDoc = ThisApplication.ActiveEditDocument 'Run juste si c'est un .ipt If oDoc.DocumentType = kPartDocumentObject Then Dim propertyName As String = "Description_Materiau" Dim propertyValue As String = "Description Materiau" customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") Try oProp = iProperties.Value("Custom",propertyName) Catch ' Assume error means not found customPropertySet.Add("", propertyName) iProperties.Value("Custom", propertyName) = propertyValue End Try Dim oPropSet2 As PropertySet oPropSet2 = oDoc.PropertySets.Item("Design Tracking Properties") SN = oPropSet2.Item("Stock Number").Value If SN = Nothing Then MessageBox.Show("Le num�ro de mat�riel n'est pas entr�", "Stock Number non-entr�") Else GoExcel.Open("\\192.168.7.10\dessins$\Inventor\iLogic\Liste_materiau.xlsx","Feuil1") GoExcel.TitleRow = 1 'compare excel data If GoExcel.FindRow("\\192.168.7.10\dessins$\Inventor\iLogic\Liste_materiau.xlsx", "Feuil1", "Stock_Number", "=", SN) ' Get a reference to the PropertySets ' we're really only using Design Tracking Properties in this case though Dim oPropSet1 As PropertySet oPropSet1 = oDoc.PropertySets.Item("Inventor Summary Information") Dim oPropSet3 As PropertySet oPropSet3 = oDoc.PropertySets.Item("Inventor User Defined Properties") 'set value to excel data iProperties.Value("Custom", propertyName) = GoExcel.CurrentRowValue(propertyName) 'This last part doesn't work. It will put the description of row 2 if it does find the Stock Number in the list
'Ne marche pas... Pourquoi? Else MessageBox.Show("Le num�ro de mat�riel n'existe pas dans la liste Excel. Ajouter le num�ro de mat�riel dans la liste ainsi que sa description et r�essayer.", "Description non-trouv�e") End If End If End If
Solved! Go to Solution.