Page 1 of 1

[Solved] Get exact type for a variant

Posted: Thu Dec 12, 2024 10:16 am
by Mr.Dandy
Hi folks

in a function, I receive a variant
Is it possible to analyze the type?
I've found the instruction IsObject but nothing to test whether it's a boolean, an integer or a string

Re: Get exact type for a variant

Posted: Thu Dec 12, 2024 12:24 pm
by JeJe
vartype(variable)

Re: [Solved] Get exact type for a variant

Posted: Sat Dec 21, 2024 2:41 pm
by Lupp
Mr.Dandy wrote: Thu Dec 12, 2024 10:16 am ... whether it's a boolean, an integer or a string.
The answer by @JeJe shows how to get the most detailed information, but you need to interpret it based on code numbers.
You can also use the function Typename(variable). In case variable is an array, a pair of parentheses is appended to the returned name.