ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Modify Registry (https://www.excelbanter.com/excel-programming/323494-vba-modify-registry.html)

Mary

VBA Modify Registry
 
Hi,

Just need some help, I'm trying to create a new key and dword value in my
registry using VBA (this is due to an annoying error message from ActiveX
component).
The code below is what I have done
Set oShell = CreateObject("WScript.Shell")
strKeyPath = "SOFTWARE\Microsoft\Office\Common\Security"
oShell.CreateKey HKEY_LOCAL_MACHINE, strKeyPath
strKeyPath =
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\Commo n\Security"
oShell.RegWrite strKeyPath & "UFIControls", "1", "REG_DWORD"

But I get an error in the CreateKey stage...
Does anyone know what's wrong, or a better alternative to the code?
Thanks!

Cheers,
Mary


Claud Balls

VBA Modify Registry
 
try:
oShell.RegWrite
instead of
oShell.CreateKey


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com