CUSTOM IPROP TO SHOW USING VBA

CUSTOM IPROP TO SHOW USING VBA

Anonymous
Not applicable
856 Views
5 Replies
Message 1 of 6

CUSTOM IPROP TO SHOW USING VBA

Anonymous
Not applicable

hi

 

id like to know if i can check using msg box in vba, if a certain name in custom iproperties already exist.

 

thanks

0 Likes
Accepted solutions (2)
857 Views
5 Replies
Replies (5)
Message 2 of 6

jdkriek
Advisor
Advisor
Accepted solution

This should do the trick:

 

Public Sub cPropCheck()
	Dim oDoc As Document
	Set oDoc = ThisApplication.ActiveDocument
	Dim customPropSet As PropertySet
	Set customPropSet = oDoc.PropertySets.Item( _
	"Inventor User Defined Properties")
	Dim iProp As Property
	Dim sName As String
	' Define name here
	sName = "MyCustomProp"
		For Each iProp In customPropSet
			If iProp.Name = sName Then
				MsgBox (sName & " already exists")
			End If
		Next iProp
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 3 of 6

Anonymous
Not applicable

>>>>jd

 

thanks a lot again !!!!  Smiley LOL

0 Likes
Message 4 of 6

jdkriek
Advisor
Advisor

You're welcome 😉

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 5 of 6

jdkriek
Advisor
Advisor
Accepted solution

If you want both status you will need to use a boolean and stop the loop:

 

Public Sub cPropCheck()
	Dim oDoc As Document
	Set oDoc = ThisApplication.ActiveDocument
	Dim customPropSet As PropertySet
	Set customPropSet = oDoc.PropertySets.Item( _
	"Inventor User Defined Properties")
	Dim iProp As Property
	Dim sName As String
	' Define name here
	sName = "MyCustomProp"
	Dim Status As Boolean
	Status = False
		For Each iProp In customPropSet
			If iProp.Name = sName Then
				Status = True 'Prop Exists
				Exit For 'Stop Loop
			End If
		Next iProp
	MsgBox (sName & " exists " & Status)
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 6 of 6

Anonymous
Not applicable

>>>>>>>>>jd

 

thank you so much again!!!Smiley Happy

0 Likes