-
Just to add to Matthew Patrick's post, you might want to take writing to the registry FURTHER. I actually did not know that one could write to the registry beyond what was natively offered in VBA but apparently you can.
In fact, instead of using the code provided by Matthew Patrick, you should use the Windows Script Host Object Model COM library. Why? Because by instantiating this COM, you will have direct access to multiple methods and properties through intellisense.
The following code essentially replicates Matthew Patrick's code, but with the added asset of intellisense. Once intellisense is available, it becomes much easier to Write to, read from or otherwise edit ANY part of the Windows Registry.
'NOTE: To write to, read from or otherwise edit the registry without being limited to a specific location, you must use the Windows Script Host Object Model library.
'Create a reference to the Windows Script Host Object Model library then use the code below to write a registry key. Use the RegDelete and RegRead methods to delete a key and get a key respectively.
Dim wsh As New WshShell
wsh.RegWrite "HKCU\Testing\Testing\OneTwoThree", "foo", "REG_SZ" 'Sample key to write; notice the abbreviated class root name 'HKCU'
Set wsh = Nothing
EndSub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules