Combo Box PowerPoint 2003

M

Mr.ChrisKelley

I'm using powerpoint to prototype for a HCI class and am having
difficulties working with combo boxes. I've been working on this
problem for days and the internet doesn't provide many resources for
using VBA in powerpoint (not that I could find anyway). The problems
I'm having is I want to have a couple of combo boxes populate when
the presentation begins. One is on the master slide and one on a
regular slide. The problem I'm running into is I'm not sure if these
commands go into the module code, class code, or slide code. I've
tried using some various code from pptfaq.com and a few other sites
but haven't found anything to work. I am also having difficulties
defining the presentation in the module and then initiating a new
class. Any help or links to websites that can provide a beginners
guide to VBA would be greatly appreciated. I am familiar with VB, but
that only gets you so far in VBA.
I've tried the following code (among others):

Public WithEvents PPTEvent As Application

Dim myobject As New Class1
Sub StartEvents()
Set myobject.appevent = Application
End Sub
Sub StopEvents()
Set myobject.appevent = Nothing
End Sub

Sub AddItemsToSelectedListBox()

Dim oShape As Shape
Set oShape = ActiveWindow.Selection.ShapeRange(1)

With oShape.OLEFormat.Object
' Add items to the list
.AddItem ("This")
.AddItem ("That")
.AddItem ("The Other")


End With

End Sub

Thanks for the help.

CMK
 
B

Bill Dilworth

Hi Chris,

An easier way to go is to create a regular autoshape object behind and
slightly larger than the combo box. Then add the following subroutine to
the autoshape and use the mouse-over action setting to run the LoadCombo
sub. That way, no event trap is needed. When the mouse passes over the
autoshape (on the way to the combobox) it fires the macro and loads the
combo box.

Sub LoadCombo()
If ComboBox1.ListCount < 2 Then
ComboBox1.AddItem "1"
ComboBox1.AddItem "2"
ComboBox1.AddItem "3"
ComboBox1.AddItem "4"
ComboBox1.AddItem "5"
End If
End Sub


Will you be at PPTLive in New Orleans? If so, drop by the help center and I
can show you how to create event traps. In the mean time, look at:
**Make PPT respond to events
http://www.pptfaq.com/FAQ00004.htm


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

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