Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CUSTOM IPROP TO SHOW USING VBA

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
akosi
702 Views, 5 Replies

CUSTOM IPROP TO SHOW USING VBA

hi

 

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

 

thanks

5 REPLIES 5
Message 2 of 6
jdkriek
in reply to: akosi

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.


Message 3 of 6
akosi
in reply to: jdkriek

>>>>jd

 

thanks a lot again !!!!  Smiley LOL

Message 4 of 6
jdkriek
in reply to: akosi

You're welcome 😉

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


Message 5 of 6
jdkriek
in reply to: jdkriek

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.


Message 6 of 6
akosi
in reply to: jdkriek

>>>>>>>>>jd

 

thank you so much again!!!Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report