How to Create a UserForm List Box in Outlook

By Allen Bethea

Outlook email forms may be a more convenient way to collect data than paper forms.
i Jupiterimages/Photos.com/Getty Images

Microsoft Outlook's Visual Basic for Applications macro programming language enables you to add a form to an email message that can collect data from its recipient. For example, you can insert a VBA UserForm and list box into your message that displays multiple items or options the recipient can choose from. Before you can add this feature to your messages, however, you need to add the Developer tab and its tools to the ribbon and change Outlook's security settings to allow VBA macros to run.

Step 1

Click the "File" tab, "Options" and then "Customize Ribbon."

Step 2

Check the box labeled "Developer" under Main Tabs and then click "OK." Outlook will automatically return to the Home panel.

Step 3

Click the “File" tab and then "Options," "Trust Center" and "Trust Center Settings.”

Step 4

Select "Macro Settings," "Enable all macros" and then click "OK" to allow the list box macro run during testing. Once you are done with your UserForm, however, you can change your settings to "Notifications for all macros" for more security.

Step 5

Restart Outlook to activate the macro security settings change.

Step 6

Click the "Developer" tab, "Macros" and then the "Macros" option.

Step 7

Type a name for your macro and then click "Create."

Step 8

Click the "Insert UserForm" button to display the form toolbox and create the UserForm that will contain your listbox.

Step 9

Click the "Listbox” control in the Toolbox, hold down the mouse button, drag the control to the UserForm and then release it.

Step 10

Click the "CommandButton” control in the Toolbox, hold down the mouse button, drag it to the UserForm and then release it.

Step 11

Right-click the “CommandButton” in the UserForm and then click "View Code" to display its VBA macro code.

Step 12

Add items to the list box using the AddItem function. For example, if you want the list box to contain the three primary colors, your code should resemble the following:

Private Sub CommandButton1_Click() ListBox1.AddItem "Red" ListBox1.AddItem "Green" ListBox1.AddItem "Blue" End Sub

ListBox1 is the name Outlook automatically gives the list box you dragged to the UserForm. The statement ListBox1.AddItem "Red" makes Red the first item in the list box.

Step 13

Click "Save," press "F5" and then click the CommandButton to run the macro. When you run the macro and click the "CommandButton" the colors Red, Green and Blue will appear in the list box.

×