ComboBox object (Outlook Forms Script)

Combines the features of a ListBox and a TextBox.

Remarks

The user can enter a new value, as with a TextBox, or the user can select an existing value as with a ListBox.

If a ComboBox is bound to a data source, the ComboBox inserts the value entered or selected by the user into that data source. If a multicolumn combo box is bound, then the BoundColumn property determines which value is stored in the bound data source.

The list in a ComboBox consists of rows of data. Each row can have one or more columns, which can appear with or without headings. Some applications don't support column headings, others provide only limited support.

The default property of a ComboBox is the Value property.

If you want more than a single line of the list to appear at all times, you might want to use a ListBox instead of a ComboBox. If you want to use a ComboBox and limit values to those in the list, you can set the Style property of the ComboBox so the control looks like a drop-down list box.

Events

Name Description
Click Occurs when the user definitively selects a value for the control that has more than one possible value.

Methods

Name Description
AddItem For a single-column ComboBox, the AddItem method adds an item to the list. For a multicolumn ComboBox, this method adds a row to the list.
Clear Removes all entries in the list in a ComboBox.
Copy Copies the contents of an object to the Clipboard.
Cut Removes selected information from an object and transfers it to the Clipboard.
DropDown Displays the list portion of a ComboBox.
Paste Transfers the contents of the Clipboard to an object.
RemoveItem Removes a row from the list in a ComboBox.

Properties

Name Description
AutoSize Returns or sets a Boolean that specifies whether an object automatically resizes to display its entire contents. Read/write.
AutoTab Returns or sets a Boolean that specifies whether an automatic tab occurs when a user enters the maximum allowable number of characters into the text box portion of a ComboBox. Read/write.
AutoWordSelect Returns or sets a Boolean that specifies whether the basic unit used to extend a selection is a word or a single character. Read/write.
BackColor Returns or sets a Long that specifies the background color of the object. Read/write.
BackStyle Returns or sets an Integer that specifies the background style for an object. Read/write.
BorderColor Returns or sets a Long that specifies the border color of an object. Read/write.
BorderStyle Returns or sets an Integer that specifies the type of border of the control. Read/write.
BoundColumn Returns or sets a Variant that identifies the source of data in a multicolumn ComboBox. Read/write.
CanPaste Returns a Boolean that specifies whether the Clipboard contains data that the object supports. Read-only.
Column Returns or sets a Variant that represents a single value, a column of values, or a two-dimensional array to load into a ComboBox. Read/write.
ColumnCount Returns or sets a Long that represents the number of columns to display in a combo box. Read/write.
ColumnHeads Returns or sets a Boolean that specifies whether a single row of column headings are displayed. Read/write.
ColumnWidths Returns or sets a String that specifies the width of each column in a multicolumn ComboBox. Read/write.
CurTargetX Returns a Long that represents the preferred horizontal position of the insertion point in a multiline ComboBox. Read-only.
CurX Returns or sets a Long that represents the current horizontal position of the insertion point in a multiline ComboBox. Read/write.
DragBehavior Returns or sets an Integer that specifies whether the system enables the drag-and-drop feature for the control. Read/write.
DropButtonStyle Returns or sets a fmDropButtonStyle value that represents the symbol displayed on the drop button in a ComboBox. Read/write.
Enabled Returns or sets a Boolean that specifies whether a control can receive the focus and respond to user-generated events. Read/write.
EnterFieldBehavior Returns or sets an Integer that specifies the selection behavior when entering a ComboBox. Read/write.
ForeColor Returns or sets a Long that specifies the foreground color of an object. Read/write.
HideSelection Returns or sets a Boolean that specifies whether selected text remains highlighted when a control does not have the focus. Read/write.
IMEMode Returns or sets an Integer that specifies the default run-time mode of the Input Method Editor (IME) for a control. Read/write.
LineCount Returns a Long that specifies the number of text lines in a ComboBox. Read-only.
List Returns or sets a Variant that represents the specified entry in a ComboBox. Read/write.
ListCount Returns a Long that represents the number of list entries in a control. Read-only.
ListIndex Returns or sets a Variant that represents the currently selected item in a ComboBox. Read/write.
ListRows Returns or sets a Long that specifies the maximum number of rows to display in the list. Read/write.
ListStyle Returns or sets an Integer that specifies the visual appearance of the list in a ComboBox. Read/write.
ListWidth Returns or sets a Variant that specifies the width of the list in a ComboBox. Read/write.
Locked Returns or sets a Boolean that specifies whether a control can be edited. Read/write.
MatchEntry Returns or sets an Integer that indicates how a ComboBox searches its list as the user types. Read/write.
MatchFound Returns a Boolean value that indicates whether the text that a user has typed into a ComboBox matches any of the entries in the list. Read-only.
MatchRequired Returns or sets a Boolean that specifies whether a value entered in the text portion of a ComboBox must match an entry in the existing list portion of the control. Read/write.
MaxLength Returns or sets a Long that specifies the maximum number of characters a user can enter in a ComboBox. Read/write.
MouseIcon Returns a String that represents the full path name of a custom icon that is to be assigned to the control. Read-only.
MousePointer Returns or sets an Integer that specifies the type of pointer displayed when the user positions the mouse over a particular object. Read/write.
SelectionMargin Returns or sets a Boolean that specifies whether the user can select a line of text by clicking in the region to the left of the text. Read/write.
SelLength Returns or sets a Long that represents the number of characters selected in the text portion of a ComboBox. Read/write.
SelStart Returns or sets a Long that represents the starting point of selected text, or the insertion point if no text is selected. Read/write.
SelText Returns or sets a String that represents the selected text of a control. Read/write.
ShowDropButtonWhen Returns or sets a fmShowDropButtonWhen value that specifies when to show the drop-down button for a ComboBox. Read/write.
SpecialEffect Returns or sets an Integer that specifies the visual appearance of an object. Read/write.
Style Returns or sets an Integer that specifies how the user can choose or set the control's value. Read/write.
Text Returns or sets a String that specifies text in a ComboBox, changing the selected row in the control. Read/write.
TextAlign Returns or sets an Integer that specifies how text is aligned in a control. Read/write.
TextColumn Returns or sets a Variant that identifies the column in a ComboBox to display to the user. Read/write.
TextLength Returns a Long that represents the length, in number of characters, of text in the edit region of a ComboBox. Read-only.
TopIndex Returns or sets a Long that represents the index of the item displayed in the topmost position in the list portion of the ComboBox. Read/write.
Value Returns or sets a Variant that specifies the value in the BoundColumn of the currently selected rows. Read/write.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.