GetSetting

Retrieve a value from the users registry (VBA).

Syntax
     GetSetting appname:="AppName", Section:="Section", Key:="Key", default:="Default"

     GetSetting "AppName", "Section", "Key", "Default"
      
Key
   AppName  The name of the application or project.

   Section  The name of the section where the key is saved.

   Key      The name of the key setting to be retrieved.

   Default  A value to return if no value is set in the key setting.

All the registry entries will appear under HKEY_CURRENT_USER\Software\VB and VBA Program Settings\

If any of the arguments do not exist in the registry then GetSetting will return the value of Default. If default is not set then a Zero length string "" will be returned.

Examples

Retrieve the value from the registry key named "LastOrderViewed":

Dim strLastOrder as String
strLastOrder = GetSetting("SS64", "DemoDB", "LastOrderViewed", 0)

“The difference between false memories and true ones is the same as for jewels: it is always the false ones that look the most real, the most brilliant” ~ Salvador Dalí

Related

DeleteSetting - Delete a value from the users registry
GetAllSettings - List the keys and values saved in the registry
SaveSetting - Store a value in the users registry


 
Copyright © 1999-2024 SS64.com
Some rights reserved