05-10-2023
05:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-10-2023
05:24 PM
Those iproperty snippets work great when you are in only one document but if you try to loop through documents the wrong document can get targeted. There is a method to target the iproperty through the filename but it is a little tricky.
Try the API route see helpful article here. Once you have the document, set up the property sets then retrieve the property. Wrap the process in a try catch to error out if no custom iprop exists.
oDoc = ThisApplication.Documents.Open(DocName, True)
Try
' Obtain the PropertySets collection object
Dim oPropsets As PropertySets = oDoc.PropertySets
Dim description As String = oPropsets.Item("Inventor User Defined Properties").Item("DESCRIPTION").Value
Dim manufacturer As String = oPropsets.Item("Inventor User Defined Properties").Item("MANUFACTURER").Value
Dim manufPartNo As String = oPropsets.Item("Inventor User Defined Properties").Item("MANUFACTURERS_PART_NUMBER").Value
oWorkbook.Sheets("Sheet1").Cells(i, 1).Value = description oWorkbook.Sheets("Sheet1").Cells(i, 2).Value = manufacturer oWorkbook.Sheets("Sheet1").Cells(i, 3).Value = manufPartNo
Catch
End Try
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan