Message 1 of 3
iProperties Update Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been working with a rule to update my "Part Number" iProperties with the first 12 characters of the filename to all iams and ipts within the iams that contain the first 5 characters of the filename. This rule is what i've got but the iproperties are not updating.
' Get the current document's file path and name Dim filePath As String filePath = ThisDoc.Document.FullFileName ' Extract the first 5 characters of the filename (optional) Dim prefix As String prefix = Mid(filePath, 1, 5) ' Ensure the filename has at least 12 characters If Len(filePath) >= 12 Then ' Extract the filename without extension Dim fileName As String fileName = System.IO.Path.GetFileNameWithoutExtension(filePath) ' Extract the first 12 characters of the filename Dim partNumber As String partNumber = Mid(fileName, 1, 12) ' Access the iProperties of the document Dim oPropSet As PropertySet oPropSet = ThisDoc.Document.PropertySets.Item("Design Tracking Properties") ' Check if "Part Number" property exists and update it If Not oPropSet.Item("Part Number") Is Nothing Then oPropSet.Item("Part Number").Value = partNumber Else ' If the Part Number property is not found, throw an error or handle it MessageBox.Show("Part Number property not found!") End If End If