On 04/09/2010 08:49 PM, TJ Frazier wrote:
Can I get a little help from someone who knows the code, to confirm my experimental observations? Then I can get the documentation updated, and fix the BASIC code.

The VarType function can be used on a variant to return the type of data therein, as documented. However, when the variant contains an array, VarType apparently returns the value x'2000' (decimal 8192) plus the "simple" type of the array variables, which is not documented.

What I'm seeing: If a variant is set with the Array function, VarType returns a 200C (8204) code, indicating type "variant", which is more or less useless. If the variant is set to an existing array:

Dim ai(2) as Integer : ai(0) = 1 : v = ai()

then the VarType returns 2002 (8194), where "2" is the type code for "integer". Similarly, explicit string arrays return 2008 (8200). Values like these occur in property sets.

This affects the OLH and wiki documentation, and BASIC code on the wiki and in the released macro libraries. I'll update the wiki, and file issues for the rest, once I'm sure what to say.

This agrees with my observations when I last checked the code.... Bit 14 is set for Array types. It can return many different types. I have not checked the code in a while, but, last I checked... These types were returned.

BASIC VarType TypeName Len Description
yes 0 Empty 0 Variant variable is not initialized
yes 1 Null 0 No valid data in an Object variable
yes 2 Integer 2 Integer variable
yes 3 Long 4 Long Integer variable
yes 4 Single 4 Single floating-point variable
yes 5 Double 8 Double floating-point variable
yes 6 Currency 8 Currency variable
yes 7 Date 8 Date variable
yes 8 String strlen String variable
yes 9 Object 0 Object variable
no 10 Error 2 Internal OOo type
yes 11 Boolean 1 Boolean variable
yes 12 Variant 0 Variant variables act like any type
no 13 DataObject 0 Internal OOo type
no 14 Unknown Type 0 Internal OOo type
no 15 Unknown Type 0 Internal OOo type
no 16 Char 1 Internal OOo type, a single text character
yes 17 Byte 1 Internal OOo type, but you can use CByte to create one
no 18 UShort 2 Internal OOo type, unsigned short integer (16 bits)
no 19 ULong 4 Internal OOo type, unsigned long (32 bits)
no 20 Long64 8 Internal OOo type, long (64 bits)
no 21 ULong64 8 Internal OOo type, unsigned long (64 bits)
no 22 Int 2 Internal OOo type, integer (16 bits)
no 23 UInt 2 Internal OOo type, unsigned integer (16 bits)
no 24 Void 0 Internal OOo type, no value
no 25 HResult 0 Internal OOo type
no 26 Pointer 0 Internal OOo type, pointer to something
no 27 DimArray 0 Internal OOo type
no 28 CArray 0 Internal OOo type
no 29 Userdef 0 Internal OOo type, user-defined
no 30 Lpstr strlen Internal OOo type, long pointer to a string
no 31 Lpwstr strlen Internal OOo type, long pointer to a “Wide” Unicode string
no 32 Unknown Type 0 Internal core string type
no 33 WString strlen Internal OOo type, “Wide” Unicode string
no 34 WChar 2 Internal OOo type, “Wide” Unicode character
no 35 Int64 8 Internal OOo type, integer (64 bits)
no 36 UInt64 8 Internal OOo type, unsigned integer (64 bits)

Sorry, I don't have time to verify these at the moment, however :-(

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to