# GetAllSettings
{: .no_toc }

Returns every key and its value in a section of an application's entry in the Windows registry.

Syntax: **GetAllSettings(** *appname* **,** *section* **)**

*appname*
: *required* String expression containing the name of the application or project whose key settings are requested.

*section*
: *required* String expression containing the name of the section whose key settings are requested.

Returns a **Variant** whose contents are a two-dimensional array of strings: each row holds one key and its value, in columns 0 and 1 respectively. **GetAllSettings** returns an uninitialized **Variant** if either *appname* or *section* does not exist.

The root of these registry settings is: `Computer\HKEY_CURRENT_USER\Software\VB and VBA Program Settings`.

### Common Errors

| Error | When |
|---|---|
| [-2147467259 (`&H80004005`)](/Reference/Run-time-Errors.md#-2147467259), *Unspecified error* | *appname* or *section* is a zero-length string |
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *appname* or *section* is **Null** |

> [!NOTE] BETA 1045
> When *appname* or *section* is a zero-length string, VB6 and 64-bit VBA raise error [5 (`&H5`)](/Reference/Run-time-Errors.md#5), *Invalid procedure call or argument*, instead.

### Example

This example first uses [**SaveSetting**](/tB/Modules/Interaction/SaveSetting.md) to make entries in the Windows registry for the application, then uses **GetAllSettings** to display every key/value in a section, and finally uses [**DeleteSetting**](/tB/Modules/Interaction/DeleteSetting.md) to remove the application's entries. Note that the *appname* and *section* names themselves are not retrieved.

```tb check_build
' Place some settings in the registry.
SaveSetting AppName := "MyApp", Section := "Startup", _
            Key := "Top", Setting := "75"
SaveSetting "MyApp", "Startup", "Left", "50"

' Retrieve them.
Dim MySettings As Variant, IntSettings As Long
MySettings = GetAllSettings(AppName := "MyApp", Section := "Startup")
For IntSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
    Debug.Print MySettings(IntSettings, 0), MySettings(IntSettings, 1)
Next IntSettings

DeleteSetting "MyApp", "Startup"
```

### See Also

- [DeleteSetting](/tB/Modules/Interaction/DeleteSetting.md) statement
- [GetSetting](/tB/Modules/Interaction/GetSetting.md) function
- [SaveSetting](/tB/Modules/Interaction/SaveSetting.md) statement
