Storing Custom Userform Controls

When developing userforms, you will find that you make the same customizations to your controls over and over again. For instance, a commandbutton has a width of 72 by default when added to a userform. I typically don’t want my commandbuttons to be that big. I can draw the size I want as I add it to the form instead of just clicking to add it, but I can’t see what size it will be as I’m drawing.

You can store controls that you’ve customized right on the Control Toolbox. In this example, I make a commandbutton and set certain properties the way I want them. Then make that commandbutton available for later use. Start by making a new tab on the Control Toolbox. Right click on the existing tab and choose New Page

Storecontrol1

Next I right clicked on the new page and renamed it to Buttons. This page will hold all my custom buttons, but you are, of course, free to organize it any way you want. Next I add a commandbutton to a userform and change its properties to the way I like them. For this button I changed:

SaveTrue
Accelorator

S
ControlTipText

Save
Width

54

the properties set, I drag this new button from the userform on to my new page on the Control Toolbox.

Storecontrol2

To put the finishing touches on it (and so you can find it later), right click on the new icon on the Control Toolbox and customize it with a tooltip.

Storecontrol3

Now when the mouse hovers over that icon, you can see just which custom commandbutton you want.

Storecontrol4

Whenver you need a Save commandbutton, you can drag this new custom control onto yor userform. You can store custom controls for any type of control that you want. Just drag it to a userform, change its properties, and drag it back.

Posted in Uncategorized

2 thoughts on “Storing Custom Userform Controls

  1. Does anyone know where Excel stores this stuff so it can be backed up? I had a number of custom controls set up which I lost when my machine was rebuilt – I thought I had backed up everything required, but evidently not.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.