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.
..
..
 
S

Steve Rindsberg

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.

Nope. In an addin, yes, but Auto_Open won't help with a presentation.

You know that. I know you know that. You know I know you know that.

Whack that boy upside the head with an Office Help File (no worries, they're
lightweights, wouldn't hurt a fly!)

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
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
 
S

Steve Rindsberg

I blame this on a rouge event generator add-in I usually have installed.

Rouge events? Bill, I worry about you. Are you getting enough sleep?

If you move along to eye-shadow events, I'm calling a doctor.
 
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

Steve Rindsberg

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

You know, Mother's Against Dyslexia.


And here all this time I thought it was a group for Drunken, Aphasic MVPs.
 
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