clearing values from a combo box

  • Thread starter Thread starter dh
  • Start date Start date
D

dh

During the operations of using a Custom form, I need to clear the old values
from a combo box. I can't seem to find the proper syntax.
Can anyone help me out?
Thanks!
DH
 
All at once!
DH
Sue Mosher said:
Clear the list all at once, or item by item?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
In that case, you can just use the Clear method. This code snippet uses a
CommandButton to toggle the combo box between a short list and no list:

Sub CommandButton1_Click()
Set objPage = Item.GetInspector.ModifiedFormPages("P.2")
Set ComboBox1 = objPage.Controls("ComboBox1")
If ComboBox1.ListCount = 0 Then
' populate list with array
strList = "red;blue;green"
arr = Split(strList, ";")
ComboBox1.List = arr
Else
ComboBox1.Clear
End If
End Sub

TIP: To look up control syntax, add a userform to your Outlook VBA project.
The MSForms library will automatically be added to Tools | References, and
you'll be able to look up MSForms control properties and methods in the
object browser.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top