Determining the full type of a variable

前端 未结 2 1133
生来不讨喜
生来不讨喜 2021-01-30 10:33

By the full type of a variable I mean the sort of information that you get in the immediate window:

I would like to determine the type information dyna

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-30 10:43

    You have the code that determines if the variable is a Variant already. Now all you need to do is get the subtype, right? There's a built in function for exactly that: VarType.

    It has limitations though. It only works for native types. It always returns vbUserDefinedType (36) for user defined types. Although, I suppose you could special case that with a call to TypeName in order to finish the job off.

提交回复
热议问题