API - search for custom properties

Oct 12, 2003 5 Replies

I have made a routine in VBA:



Public Function CustPropFound(CustProp As Variant, model As ModelDoc2) As Boolean Dim numCustProps As Long Dim Names As Variant



Names = model.GetCustomInfoNames2("") numConfigs = model.GetCustomInfoCount2("") i = 0 CustPropFound = False While i < numConfigs And Not CustPropFound If model.CustomInfo2("", Names(i)) = CustProp Then CustPropFound = True End If i = i + 1 Wend End Function



But somehow it can't detect when the Names(i) = CustProp. When looking at the variables they look the same...



Is another way of comparing required?



John


Perhaps make the CustProp a string not a variant...

Best Regards,

What are you actually trying to achieve? In the code above you seem to be comparing custom property value (model.CustomInfo2()) with variable CustProp... If I understood right, you should have If Names(i) = CustProp instead.

-h-

Yep... just found that myself. Embarrassing....

One further note... You may want to ensure that your comparison is case-insensitive by doing a UCase on both sides: If ucase(Names(i)) = ucase(CustProp)

Regards, Brenda

----------------------------------------------- Brenda D. Bosley CustomSolids

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required