API - search for custom properties

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

Reply to
John
Loading thread data ...

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

Best Regards,

Reply to
Robert Hanson

Reply to
John

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-

Reply to
Heikki Leivo

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

Reply to
John

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

Reply to
Brenda D. Bosley

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.