Somanna
Somanna

Reputation: 346

Open Windows Registry Editor from excel

I want to open the default registry editor with a specific registry key opened when I click on a command button in a excel worksheet. Is there anyway I can do it?
Thanks.

Upvotes: 0

Views: 567

Answers (1)

Louis
Louis

Reputation: 3632

By default, regedit.exe do not allow opening itself with a specified key. If you only need to read a key value, you can use VBA Windows Scripting Feature to do it:

Dim myWS As Object
Dim i_RegKey As String
'Change this with your Registry Key
i_RegKey = "HKEY_USERS\S-1-5-18\Control Panel\Accessibility\HighContrast\Flags"

On Error Resume Next
'Access Windows scripting
Set myWS = CreateObject("WScript.Shell")
'Read key from registry
RegKeyRead = myWS.RegRead(i_RegKey)
'Do something with this value

Otherwise, if you need to read it with regedit.exe, you can download a Microsoft tool called regjump.exe and setting it to jump to your specified key. More info on how to do that here.

Hope this helps.

Upvotes: 4

Related Questions