Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Managing add-ins via the registry Athos Setting up and Configuration of Excel 0 February 5th 09 01:00 PM
System Registry Darryl Bailey Excel Programming 3 October 10th 03 03:47 PM
Registry Tom Ogilvy Excel Programming 1 July 16th 03 01:02 AM
Registry Patrick Molloy[_4_] Excel Programming 0 July 15th 03 12:45 PM


All times are GMT +1. The time now is 08:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"