How to Add items to a ComboBox list

J

JDP@Work

Office PP 2K

I have comboboxes on a few slides.

I've added the following code to the slide....

However I run F5 in VBA and I see the values....

However when I save the project and show from the file manager, the drop downs
don't populate.

I know that I have security set to medium and select Yes when prompted.

What gives?


Public Sub AddItemsToList()

ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear

ComboBox1.AddItem " "
ComboBox1.AddItem "Soybeans"
ComboBox1.AddItem "Lima Beans "
ComboBox1.AddItem "String Beans"

ComboBox2.AddItem " "
ComboBox3.AddItem "Peas"
ComboBox3.AddItem "Celery"
ComboBox2.AddItem "Carrots"

ComboBox1.AddItem " "
ComboBox1.AddItem "Potatos "
ComboBox1.AddItem "Onions"
ComboBox1.AddItem "Chocolate"

End Sub

TIA

JeffP.....
 
B

Bill Dilworth

How are you triggering AddItemsToList() to run?

How does it know when to run? Try changing the routine name to Sub
Auto_Open() and it will run when the presentation is opened, if the security
setting will let it.

--
Bill Dilworth, Microsoft PPT MVP
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
J

JDP@Work

Hey, (said softly, like on all the hip tv shows)

How'about I add a rather large text box slightly to the right and underlapping
the combobox dropdown arrow.

I could add to that text box, white text on a white background, so it won't be
seen and Action to be run my macro on mouseover?

..... ah'ha that works.

What an "F" & way to do things.....(broght to you today by the letters "F" and
"N")

TIA

(still speaking in a moody tone..... hey)

JeffP.....
POw'aPOINT is not my friend.period
 
B

Brian Reilly, MS MVP

There's actually a much easier way.

Right click on the combobox and choose View Code.
In the upper right and part of the VBE window there's a list of events
to choose from. choose the DropButtonClick and add your code there.

Private Sub ComboBox1_DropButtonClick()
ComboBox1.Clear
ComboBox1.AddItem " "
ComboBox1.AddItem "Soybeans"
ComboBox1.AddItem "Lima Beans "
ComboBox1.AddItem "String Beans"
End Sub

Brian Reilly, PowerPoint MVP
 
B

Bill Dilworth

Did I ever tell you about the support group I read about, D.A.M.?

You know, Mother's Against Dyslexia.

:)
 
S

Shyam Pillai

If you'll let me modify that:

If ComboBox1.ListCount = 0 Then
ComboBox1.Style = fmStyleDropDownList
ComboBox1.AddItem "Soybeans"
ComboBox1.AddItem "Lima Beans "
ComboBox1.AddItem "String Beans"
End If
 

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

Top