It works with COM, but it can't be counted on. Very often returns "O" for items that are not objects, i.e. arrays. Sometimes even primitives. Has something to do with the COM wrapper used, I think (variants).
>>To summarize:
>>
>>There are only 2 conditions in which I am able to get vartype to generate an error:
>>1. _vfp.foo [or _vfp.anything not defined to _vfp]
>>
>>2. oForm = newobject("form")
>> vartype(oForm.BadProp) returns U
>> oForm = .null.
>> vartype(oForm) returns X
>> vartype(oForm.anything) generates an error
>>
>>Personally, I see no problem with the generation of the error for the second condition. I am ambivalent about the first condition because I seldom use _vfp. If I do, I always make dang sure the property exists before I add it to my code.
>
>Well, VARTYPE doesn't throw an error when checking defined properties of COM objects, but it does throw an error for undefined properties of COM objects. (For any body that doesn't see the relevance, _VFP is actually VFP's COM interface, and not a native fox object).
>
>I suspect that you uncovered still one more situation that VARTYPE wasn't built to handle. I am actually a little surprised that VARTYPE works with COM properties at all.
Eric Shaneson
Cutting Edge Consulting