VBA offers the functions GetSetting, SaveSetting, GetAllSettings and DeleteSetting for reading and writing the Windows Registry. (For detailed info see the Microsoft VBA help for these functions or look at the
MSDN)
But unfortunately you can't access the entire registry, only the path HKEY_CURRENT_USER\Software\VB and VBA Program Settings\. So you
(
Read more... )
Comments 4
I have a program that goes to 12 different locations and each location uses it's own backend. Of course, the backend address/URL in each location is different.
I had started to use a database table to make updating of the links easier, but it has drawbacks if a WAN connection is involved in the first link.
Using a registry check was a better answer but I wanted the information in HKLM and not HKCU. Your code provided the means to make it happen.
I still have some fine tuning to do, but the solution is more elegant and will make program updates easier.
Reply
Sub compactCheckCountRegistryChange()
Dim myRegKey As String
Dim myValue As String
Dim myAnswer As Integer
myRegKey = "HKEY_USERS\ (find your own numbers) \Identities\{ (find your own numbers) }\Software\Microsoft\Outlook Express\5.0\Compact Check Count"
'check if key exists
If RegKeyExists(myRegKey) = True Then
If RegKeyRead(myRegKey) > 95 Then
RegKeySave myRegKey, 1
End If
Else
MsgBox "Check Sub compactCheckCountRegistryChange. Outlook Express -Compact Check Count- registry key cannot be found."
End If
End Sub
Reply
I'm also wondering whether this better or worse than declaring the advapi32.dll routines in VBA. both have portability issues...
Reply
This does not work when trying to read / write registry in HKLM on Windows 7?
Any hints oh how to read / write HLM keys from VBA (more particularly from Access) on Windows 7 ?
Cheers,
L@u
Reply
Leave a comment