Combo Boxes

  • Thread starter Thread starter anonymous
  • Start date Start date
A

anonymous

Hi, I'm not sure if this is the right group to ask this question but if
it isn't can someone tell me the right newsgroup to go to. So whenever
I try to use this code to make a combo box with the items "Test" and
"Test 2" it shows more than one of each item. Here is the code:

Public Sub InitListBox()
ComboBox1.AddItem "Test", 1
ComboBox1.AddItem "Test 2", 2
End Sub

or

Public Sub Auto_Open()
ComboBox1.AddItem "Test", 1
ComboBox1.AddItem "Test 2", 2
End Sub
 
Try adding a
ComboBox1.Clear
before your code adds stuff.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
I tried:

Public Sub InitListBox()
ComboBox1.Clear
ComboBox1.AddItem "Test", 1
ComboBox1.AddItem "Test 2", 2
End Sub

and

Public Sub Auto_Open()
ComboBox1.Clear
ComboBox1.AddItem "Test", 1
ComboBox1.AddItem "Test 2", 2
End Sub

but now there is nothing in the combo box
 
A trick I use for this ...

....create a rectangle behind the ComboBox that is a bit bigger than the
combo box. Then add this macro:

Sub LoadComboBox()
If ComboBox1.LineCount < 2 Then
ComboBox1.Clear
ComboBox1.AddItem "Test", 1
ComboBox1.AddItem "Test 2", 2
End If
End Sub

Then set the MouseOver action setting on the rectangle to run the macro.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
Rectangle tool on the drawing toolbar (usually across the bottom of the edit
pane between the arrow and circle tools).

To move it behind the combo box, right click on the rectangle and select
Order=> Move backwards (repeat until combo box is on top).


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
yahoo2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Combo Box 13
A ComboBox question 6
list box remove item by combobox 4
using combobox for drop down menu? 10
How to Add items to a ComboBox list 11
ComboBox with VBA 0
Stop macro from running more than once? 10
drop down box 3

Back
Top