Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
william
in reply to: johnsonshiue

Hello @johnsonshiue 

I have just tried that, I get the same error.

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

Dim oCustomPropertyName As String 
oCustomPropertyName = CStr(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

Is the InStr command the best way of going about this? I originally took @Curtis_Waguespack code from an earlier post (https://forums.autodesk.com/t5/inventor-forum/how-to-remove-custom-iproperty-with-ilogic/td-p/436406...

but the ".contains" method doesnt seem to work if the search term is inside the string, eg. it will not pick up that "Item" is contained inside "Item8_Code" 

 

so I found another post that I though would be applicable (https://forums.autodesk.com/t5/inventor-customization/code-vb-for-if-quot-value-quot-contains-quot-t...

 

Any help would be appreciated.