> ## Content Index
> Fetch the complete content index at: https://nolongerset.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Setting the Ribbon Name in Code
- URL: https://nolongerset.com/setting-the-ribbon-name-in-code/
- Published: 2022-06-29T03:59:00.000Z
- Updated: 2026-05-08T12:56:44.000Z
- Description: You don't need to use the options dialog to set a custom ribbon for your Microsoft Access application.
- Author: Mike Wolfe
- Tags: Ribbon, #Import 2026-05-20 02:59

The [typical way to choose a custom ribbon in an Access application](https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/how-to-apply-a-custom-ribbon-when-starting-access#apply-customized-ribbons-when-access-starts) is via **File > Options > Current Database > Ribbon Name**.

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/06/image-79.png)

But what if you want to assign that ribbon name in code? It's quite easy once you know where the information is stored: in a database property named *CustomRibbonID:*

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/06/image-80.png)

So, if we wanted to set the application-level ribbon to our Print Preview ribbon, we could use the following code:

```vba
CurrentDB.Properties("CustomRibbonID").Value = "gbRibbonPrintPreview"
```

### Handling the "Property not found" Error

Now, let's say you haven't set a custom Ribbon Name through the Options dialog yet–or you set it at one time but then cleared it out:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/06/image-82.png)

If your "Ribbon and Toolbar Options" look like the above screenshot, then you won't be able to assign a value to the *CustomRibbonID* database property because it doesn't exist:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/06/image-83.png)

In this situation, you would need to create the property itself and then append it to the database properties collection. You can do this in a single line of code if you wanted to:

```vba
CurrentDB.Properties.Append CurrentDB.CreateProperty("CustomRibbonID", dbText, "gbRibbonTaxColl2k")
```

The problem is that if you run the above code and the property already exists, then you'll get a different error message:

![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2022/06/image-85.png)

## The `SetProp()` Routine

Rather than worrying about whether the property exists or not, you can just use my [SetProp() routine](https://nolongerset.com/database-properties-for-thee/#adding-custom-database-properties) which will handle either scenario gracefully:

```vba
SetProp "CustomRibbonID", "gbRibbonTaxColl2k" 
```

### Referenced articles

[Database Properties for TheeThe DAO Database object has a Properties collection. You can read through the list of properties to extract saved database options. You can also add your own properties to the object.![](https://nolongerset.com/favicon.png)No Longer SetMike Wolfe![](https://storage.ghost.io/c/eb/d7/ebd732c1-5f03-4f07-b386-5d08557e15c9/content/images/2020/09/sport-1014015_1920.jpg)](https://nolongerset.com/database-properties-for-thee/#adding-custom-database-properties)

### External references

[Apply a custom ribbon when starting AccessHow to apply customized ribbons when opening a database in Access 2013.Microsoft Docso365devx![](https://docs.microsoft.com/en-us/media/logos/logo-ms-social.png)](https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/how-to-apply-a-custom-ribbon-when-starting-access#apply-customized-ribbons-when-access-starts)

*Image by [Bruno /Germany](https://pixabay.com/users/bru-no-1161770/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=2527432) from [Pixabay](https://pixabay.com/?utm%5Fsource=link-attribution&utm%5Fmedium=referral&utm%5Fcampaign=image&utm%5Fcontent=2527432)*