How to Read REG key (default) ???

DaLiMan

Active Member
Joined
Jun 1, 2004
Messages
295
Hi,

I found several scripts how to Read/Write the windows Registry.
But I cannot figure out how to Read the (Default) key.

I'm using this code, but gives error on the (default) key.

Anybody has any ideas how to get this working?
Other keys with "real" names work perfectly.

I created a code from the example given on this website:
http://www.jpsoftwaretech.com/vba/grab-registry-settings-through-vba-using-wmi/

<code>

'===== GetStdRegProv, which calls the WMI service and returns the appropriate object. =====
Function GetStdRegProv() As Object
' http://msdn.microsoft.com/en-us/library/aa394600(VS.85).aspxDim strComputer As String
strComputer = "."
Set GetStdRegProv = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
End Function


' ===== READ REG VALUES =====
Function CDT_REGread_UserData()

Dim RegistryKey As String
Dim strValue As String
Dim objReg As Object
Set objReg = GetStdRegProv ' <--- Get WMI Object


RegistryKey = "Software\Microsoft\Internet Explorer"

objReg.GetStringValue &H80000001, RegistryKey, "(default)", strValue
myVK = strValue
Debug.Print "VK: " & myVK

End Function

</code>
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top