Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Registry Settings

    How do I store and then read a value in the Registry?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Registry Settings

    In XL 97 and 2000 you can use the SaveSetting statement to write to the registery and the GettSetting Function to retrieve a value. Try the VBA help and search for SaveSetting, and check out the See also pages.

    Andrew C

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Registry Settings

    Almost There! The example cope from Help is:
    SaveSetting appname := "MyApp", section := "Startup", _
    key := "Top", setting := 75
    I'm OK with the 'setting' and 'key'. Should 'appname' be the name of an Object Variable that points to Excel? Also, does 'section' need to pre-exist, or will it create a new section? Cheers, Andy.

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Registry Settings

    If the section does not exist it is created. As I understand it the only KEY you can write to with these functions is <pre> HKEY_CURRENT_USERSoftwareVB and VBA Program Settings </pre>

    Also Appname can be the name of your project.

    Try the examples from help , and then check the above key using RegEdit to see the effects.

    There are ways using API calls to interact more deeply in the registry, but unless you know exactly what you are doing, they are best avoided.

    Hope that clarifies

    Andrew C

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •