nhmabv
09-15-2012, 11:40 AM
I am currently writing to the registry with the following code under Word VBA 2003 running on XP sp3:
Sub RegSave(MyKey as String, MyVal as String, Optional MyType as String = "REG_SZ")
Dim myWS as Object
Set myWS = CreateObject("WScript.Shell")
myWS.RegWrite (MyKey, MyVal, MyType)
End Sub
This works great, if the key does not exist, it is created. If existing, it is updated with the new value.
However,
Running on Win7 I get an error when calling it where the key does not exist. "Invalid root in registry key"
"HKEY_LOCAL_MACHINE\SOFTWARE\abc\def\"
If I manually create the key by accessing the 64 bit registry by typing at the command line: %systemroot%\syswow64\regedit -m and create the key, my RegRead (which is also a windows scripting registry read function) is able to read it.
However, I need to create and update these key from my VBA application.
I have read a lot on the redirection to WOW6432NODE but I cant fit this into actual code.
A billion thanks for help
Sub RegSave(MyKey as String, MyVal as String, Optional MyType as String = "REG_SZ")
Dim myWS as Object
Set myWS = CreateObject("WScript.Shell")
myWS.RegWrite (MyKey, MyVal, MyType)
End Sub
This works great, if the key does not exist, it is created. If existing, it is updated with the new value.
However,
Running on Win7 I get an error when calling it where the key does not exist. "Invalid root in registry key"
"HKEY_LOCAL_MACHINE\SOFTWARE\abc\def\"
If I manually create the key by accessing the 64 bit registry by typing at the command line: %systemroot%\syswow64\regedit -m and create the key, my RegRead (which is also a windows scripting registry read function) is able to read it.
However, I need to create and update these key from my VBA application.
I have read a lot on the redirection to WOW6432NODE but I cant fit this into actual code.
A billion thanks for help