Well I'd look at these two UDFs from Jens that certainly can do it for you and if you want you can see how it's being done.

ARRAYENUMKEY() - Creates an array of names of the subkeys contained in a registry key
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=82422


ArrayEnumValue() - Creates an array of names of the registry entries contained in a registry key or subkey
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=82425