Quote Originally Posted by Dnereb
Thanks to both of you, I hoped there was an way to compare to them all at once. but that seems to be wishfull thinking.
Sure there is!

VB Code:
  1. Public Enum EnumBaseKeys
  2.     [_ENUMBASEKEYS_FIRST] = &H80000000
  3.     HKEY_CLASSES_ROOT = &H80000000
  4.     HKEY_CURRENT_USER = &H80000001
  5.     HKEY_LOCAL_MACHINE = &H80000002
  6.     HKEY_USERS = &H80000003
  7.     [_ENUMBASEKEYS_LAST] = &H80000003
  8. End Enum
  9.  
  10. ' .......
  11.  
  12. Public Function Makekey(Optional Hkey As EnumBaseKeys, Optional Subkey As String) As Boolean
  13.     If ((Hkey >= [_ENUMBASEKEYS_FIRST]) And (Hkey <= [_ENUMBASEKEYS_LAST]) Then
  14.         ' ...
  15.     End If
  16. End Function

The brackets around the FIRST and LAST members hide them from the Intellisense menu, so you won't accidentally use them when assigning values