View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mary Mary is offline
external usenet poster
 
Posts: 190
Default 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