These next couple of codings are mine and Mike’s, as in the last post, but I have just rearranged them a bit and made very minor changes, just to make it a bit easier to compare.
Code:'Public Const HKEY_CLASSES_ROOT = &H80000000 ' https://eileenslounge.com/viewtopic.php?p=314945#p314945 https://www.devhut.net/enumerating-registry-subkeys-using-wmi-in-vba/ Public Sub ListCLSIDs_and_ProgIDs_Mike() ' Mike ' https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p=24128&viewfull=1#post24128 Dim Ws As Worksheet: Set Ws = ThisWorkbook.Worksheets("CLSIDsOldVista4810TZG") ' Set Ws = Me ' Dim RegObject As Object, entryArray() As Variant, KeyValue As Variant ' Dim KeyValue As String ' Mike .... error is somewhat misleading. It is down to the fact that the XP (and presumably Vista and W7, although I can't test them) WMI provider (which gives us the Registry access) handles returning Null differently than the one on W10. Simply change the declaration of KeyValue from Dim KeyValue As String to Dim KeyValue As Variant https://eileenslounge.com/viewtopic.php?p=314953#p314953 ' Dim KeyPath As String ' - ?? Dim strComputer As String: Let strComputer = "." Set RegObject = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") RegObject.EnumKey &H80000000, "CLSID", entryArray() ' HKEY_CLASSES_ROOT, "CLSID", entryArray() ' Let Ws.Cells(1, 6).Value = "CLSID": Let Ws.Cells(1, 7).Value = "ProgID" Dim ExRowCnt As Long ' ================================================================================================ For ExRowCnt = 0 To UBound(entryArray()) RegObject.getstringvalue &H80000000, "CLSID\" & entryArray(ExRowCnt) & "\ProgId", "", KeyValue Let Ws.Range("F" & ExRowCnt + 2 & "") = entryArray(ExRowCnt) Let Ws.Range("G" & ExRowCnt + 2 & "") = KeyValue Next ExRowCnt ' =================================================================================================== End Subhttps://i.postimg.cc/FRxkK7Wd/Me-Cls...s-Prog-IDs.jpgCode:Public Sub ListCLSIDs_Me() ' Me http://www.eileenslounge.com/viewtopic.php?f=26&t=22603&p=289007#p289007 ' https://powershell.one/wmi/root/cimv2/stdregprov-EnumKey ' https://www.vbforums.com/showthread.php?552899-Getting-all-sub-keys-from-a-registry-value https://www.vba-tutorial.de/apireferenz/registry.htm Dim Ws As Worksheet: Set Ws = ThisWorkbook.Worksheets("CLSIDsOldVista4810TZG") ' set ws = Set Ws = Me ' Set Ws = ActiveSheet Dim RegObject As Object, KeyValues() As Variant, KeyValue As Variant Set RegObject = GetObject("winmgmts:\\.\root\default:StdRegProv") RegObject.EnumKey 2147483650#, "SOFTWARE\Classes\CLSID", KeyValues() ' https://powershell.one/wmi/root/cimv2/stdregprov-EnumKey Dim ExRowCnt As Long ' ================================================================================================ For Each KeyValue In KeyValues() Let ExRowCnt = ExRowCnt + 1 Let Ws.Range("A" & ExRowCnt + 1 & "") = KeyValue Next ' =================================================================================================== End Sub ' https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p=24127&viewfull=1#post24127
____





Reply With Quote
Bookmarks