Results 1 to 11 of 11

Thread: VBA + SavesSetting statement registry location

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    VBA + SavesSetting statement registry location

    Does anyone know why SaveSetting saves to HKEY_USERS under a SID rather than to HKEY_CURRENT_USER?

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,973

    Re: VBA + SavesSetting statement registry location

    How do you figure that?

    https://learn.microsoft.com/en-us/of...ting-statement

    The root of these registry settings is: Computer\HKEY_CURRENT_USER\Software\VB and VBA Program Settings.
    And HKEY_CURRENT_USER gets mapped to the logged in User-SID in HKEY_USERS
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    I run this code in VBA
    Code:
    Sub test()
    SaveSetting "Adorable", "Sect1", "testVal", "yes"
    End Sub
    The key is created in HKUSERS not HKCU
    Attached Images Attached Images  

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,973

    Re: VBA + SavesSetting statement registry location

    *shrug*
    Code:
    Sub test()
    SaveSetting "Adorable", "Sect1", "testVal", "yes"
    End Sub
    -->
    Name:  Unbenannt.jpg
Views: 1399
Size:  13.4 KB

    -->
    Name:  Unbenannt21.jpg
Views: 1399
Size:  16.5 KB
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    So for some reason HKCU isn't getting updated from HKU.

  6. #6
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,973

    Re: VBA + SavesSetting statement registry location

    Quote Originally Posted by AdorablePlum View Post
    So for some reason HKCU isn't getting updated from HKU.
    Refresh Regeditor? (close/open)
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    I've tried that. Still the same.

  8. #8
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,973

    Re: VBA + SavesSetting statement registry location

    Quote Originally Posted by AdorablePlum View Post
    I've tried that. Still the same.
    Then i'm out of ideas
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  9. #9

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    Thanks for trying. At least I know that it's not normal

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    I ran this and it went to HKU but not HKCU

    Code:
    Sub X()
    Dim WshShell As Object
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.RegWrite "HKEY_CURRENT_USER\Software\TEST2\Settings\TestKey", "TestValue", "REG_SZ"
    Set WshShell = Nothing
    End Sub

    Ran whomai /user
    Checked in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    Seem to be the right SID

  11. #11

    Thread Starter
    Member
    Join Date
    Aug 2024
    Posts
    40

    Re: VBA + SavesSetting statement registry location

    Another example. I went to show seconds in the taskbar clock which should be a DWORD under
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

    I put it there but nothing happened. However, when I put it under HKEY_USERS and my SID the seconds appeared immediately.

Posting Permissions

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



Click Here to Expand Forum to Full Width