![]() |
Value from Registry
Is there an Excel VBA board? I cannot find it. May I post this here please?
In Word, it is easy to get a registry entry using the following formula: I have set a value via Word to the registry key: HKEY_LOCAL_MACHINE\Software\SECTIONNAME", "ENTRYNAME") How can I read it in Excel? I tried the formula suggested by the Help system under "Registry" and came up with the following, but it doesn't work: ValueIs = GetSetting(AppName:="MyApp", Section:= _ "HKEY_LOCAL_MACHINE\Software\SECTIONNAME", key:="ENTRYNAME") What am I doing wrong? Thanks, Roy |
Value from Registry
Hi Roy
Is there an Excel VBA board This is the good one Try this HOWTO: Use the Windows Script Host to Read, Write, and Delete Registry Keys http://support.microsoft.com/default...;EN-US;Q244675 I make this one some time back, maybe it is useful for you Sub GetKeyValue() Dim Shell As Object Dim keyname As String Dim valuename As String Dim keyvalue As Integer keyname = "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\ Outlook\Options\Mail\" valuename = "Send Mail Immediately" Set Shell = CreateObject("wscript.shell") On Error Resume Next keyvalue = Shell.regread(keyname & valuename) If Err.Number < 0 Then MsgBox "Invalid Registry Entry" Else MsgBox keyvalue End If End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Roy Lasris" wrote in message ... Is there an Excel VBA board? I cannot find it. May I post this here please? In Word, it is easy to get a registry entry using the following formula: I have set a value via Word to the registry key: HKEY_LOCAL_MACHINE\Software\SECTIONNAME", "ENTRYNAME") How can I read it in Excel? I tried the formula suggested by the Help system under "Registry" and came up with the following, but it doesn't work: ValueIs = GetSetting(AppName:="MyApp", Section:= _ "HKEY_LOCAL_MACHINE\Software\SECTIONNAME", key:="ENTRYNAME") What am I doing wrong? Thanks, Roy |
Value from Registry
Roy,
Programming is the VBA board. Excel VBA also has GetSetting and SaveSetting. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Roy Lasris" wrote in message ... Is there an Excel VBA board? I cannot find it. May I post this here please? In Word, it is easy to get a registry entry using the following formula: I have set a value via Word to the registry key: HKEY_LOCAL_MACHINE\Software\SECTIONNAME", "ENTRYNAME") How can I read it in Excel? I tried the formula suggested by the Help system under "Registry" and came up with the following, but it doesn't work: ValueIs = GetSetting(AppName:="MyApp", Section:= _ "HKEY_LOCAL_MACHINE\Software\SECTIONNAME", key:="ENTRYNAME") What am I doing wrong? Thanks, Roy |
Value from Registry
Ron,
Thanks. It worked fine, except since my values were strings and not integers, I had to change the keyvalue dim to string and the comparison at the bottom to "" not "0". Thanks for your help. Roy |
All times are GMT +1. The time now is 02:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com