Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
william
901 Views, 4 Replies

I-Logic delete iproperties if they contain a text string

Hello 

I am trying to write some code to look through the custom i-properties and if the name of the i-property contains the search term, then delete it. 

 

So far I have got to here...

oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
oCustomPropertyName = (oCustomPropertySet.Name)

Dim searchTerm As String 
searchTerm = "Item"

For Each oCustomPropertyName in oCustomPropertySet
	If InStr(1, oCustomPropertyName, searchTerm, CompareMethod.Text) >0 Then 
		MessageBox.Show("We found it", "Debug")

	Else
		MessageBox.Show("We didnt find it", "Debug")

	End If
	
Next

 

The error i am getting is "Conversion from type 'Property' to type 'String' is not valid."

 

What am I doing wrong?

 

Regards