Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ComboBoxes

272 views
Skip to first unread message

Rob Gould

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
Hello all,

Does anybody know how I can include a ComboBox in a slide in PowerPoint 97?
What I want to have is a drop-down list with options in there which, when
selected, will take me to a different slide.

Please help - wading through VB is not easy!

Thanks.

Rob Gould
gro...@nn.independent.co.za

Steve Rindsberg

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to

Try this:

Add the combo box to the slide
Rightclick it and choose Edit Combobox or View Code

Add the following:

Private Sub ComboBox1_GotFocus()
me.ComboBox1.AddItem("This")
me.ComboBox1.AddItem("That")
me.ComboBox1.AddItem("The other")
End Sub


Now start the slide show and click the combo. Clicking it will trigger the
GotFocus event, load the combo with stuff that you can then select.

Generally speaking, stuff like combos make more sense on forms rather than
directly on a slide.
--
Steve Rindsberg, PowerPoint MVP
Got a PowerPoint wish/suggestion/beef?
Email msw...@microsoft.com with PowerPoint in the subject line

PPT FAQ - http://www.rdpslides.com/pptfaq
RnR PPTools - http://www.rdpslides.com/pptools
ZAP! for service bureaus - http://www.rdpslides.com/zap

Rob Gould <gro...@nn.independent.co.za> wrote in message
news:3a112efd$0$2...@helios.is.co.za...

Rob Gould

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
Thanks Steve...The box is now added, but how do I assign commands so that if
I select "That" for example, It will take me to Slide number 7?

"Steve Rindsberg" <drop...@rathole.nul> wrote in message
news:#lZa#MkTAHA.174@cppssbbsa04...

Steve Rindsberg

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
For starters, an oversight. Add me.combobox1.clear to that other code
before you start adding new items, otherwise each time it executes, it'll
re-add items to the list. Ugly.

You could do something like:

Private Sub ComboBox1_Change
msgbox me.ComboBox1.ListIndex
End Sub

That'll show you the number ( 0-based ) of the item picked. That is, if
they pick the first item on the list, it'll be 0, second is 1 and so forth.

You could then choose the right slide to go to based on the choice they
made.
I can't at the moment remember the correct code to get GotoSlide to work in
slide show view, but maybe somebody else will pop in with that.

--
Steve Rindsberg, PowerPoint MVP
Got a PowerPoint wish/suggestion/beef?
Email msw...@microsoft.com with PowerPoint in the subject line

Rob Gould <gro...@nn.independent.co.za> wrote in message

news:3a114c4f$0$2...@hades.is.co.za...

PTT, Inc.

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
Rob,

Try this:

With SlideShowWindows(1).View
.GotoSlide 3, msoTrue
End With

This should go to Slide #3 and restart any animations on the slide. The
other use is the SlideID number. You can search HELP on this to see what
the SlideID is for each slide. That way if you move or add slides the slide
number (3) might change, but the SlideID will not.

Hope this helps.

Bill Foley
www.pttinc.com
Steve Rindsberg wrote in message ...

Steve Rindsberg

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
Thanks, Bill. I knew the cavalry would come to the rescue.

Oh, and that triggers another thought:

Grab PPTools, use the Slide Namer thingie to name each of the "target"
slides something meaningful.
Then put the same <something meaningful> into the list box contents. The
list box selection then becomes the SlideID and ya just go there. A wee
little bit more work, a LOT simpler to maintain, yowza.

--
Steve Rindsberg, PowerPoint MVP
Got a PowerPoint wish/suggestion/beef?
Email msw...@microsoft.com with PowerPoint in the subject line

PTT, Inc. <ptt...@itexas.net> wrote in message
news:eb8Crwn...@cppssbbsa02.microsoft.com...

PTT, Inc.

unread,
Nov 14, 2000, 3:00:00 AM11/14/00
to
I come bearing tuna that melts in your mouth and not in the can! Think Jeff
would be interested! HA!

Forgot about the Slide Namer thingie (real technical, aren't ya?). I guess
I ought to try it out.

Rob Gould

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
Phew! Thanks for all that guys. I will print this all out and get to
work/play at trying to get it working!

Thanks again

Rob

"PTT, Inc." <ptt...@itexas.net> wrote in message

news:O0KHIkr...@cppssbbsa02.microsoft.com...

Rob Gould

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
Okay...the idiot (me!) has tried and failed! I think with the various
responses/suggestions, I have become confused with how the code should look.
Could you please tell me the entire code so that I can then just copy and
paste it into VB? We can use "Slide 1", "Slide 2", "Slide 3" in the
example, i.e have a PPoint presentation of 3 slides and the combobox on
Slide 1 with 2 choices in the box - Slide 2 and Slide 3. When I select
Slide 2 it will go to that slide and the same if I select Slide 3.

If I get that, I can adapt it to my needs. Where can I get PPTools?

Thanks again.

Rob

"Rob Gould" <gro...@nn.independent.co.za> wrote in message

news:3a1523e8$0$2...@helios.is.co.za...

PTT, Inc.

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
At the following:

Will try to set up a sample for you, but things are kind of hectic here
today. Maybe Shyam can provide a quick example. (notice how I pass the
buck).

Bill Foley
www.pttinc.com
Rob Gould wrote in message <3a153315$0$2...@helios.is.co.za>...

Shyam Pillai

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
Rob,
Add a combo box to the slide.
Double click on it and paste the code given below:

' ===== Beginning Of Code =====
Private Sub ComboBox1_Change()
Dim IDX As Long
If ComboBox1.Text = "" Then Exit Sub
' Get the index of the slide since the GotoSlide requires an Index
IDX = ActivePresentation.Slides(ComboBox1.Text).SlideIndex
' Or you could also use :
' IDX = SlideShowWindows(1).Presentation.Slides(ComboBox1.Text).SlideIndex

'Move to the slide
SlideShowWindows(1).View.GotoSlide IDX
End Sub

Sub LoadCombo()
' Name the slides identical to the text in combo box
ActivePresentation.Slides(2).Name = "Second Slide"
ActivePresentation.Slides(3).Name = "Third Slide"
ComboBox1.Clear
With ComboBox1
.AddItem "Second Slide"
.AddItem "Third Slide"
End With
End Sub
' ===== End Of Code ====

Close the code window
Return to PowerPoint.
Select Tools|Macro|Macro...
Select LoadCombo routine to run it. This will load all the entries into the
combobox. Alternately you could also provide an shape set to Background
color and assign the loadcombo macro to run when clicked on it to load the
entries.

Run the show, make selection in combo box to move to appropriate slide.
--

Regards
Shyam Pillai

http://officetips.homepage.com
--


"PTT, Inc." <ptt...@itexas.net> wrote in message

news:OnLHqKKUAHA.174@cppssbbsa04...

PTT, Inc.

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
I knew you'd come through! Notice how I'm not so busy now! HA! When I
grow up I want to be like you. Are there any downfalls I should prepare
myself for?

Bill
Shyam Pillai wrote in message ...

Brian Reilly, MS MVP

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
Well, of course there's nothing wrong with Shyam's code, but I was in
a mood to add to it. The key change is to add a combo box on the slide
master, which would be available on every slide and use a named Text
box's text as the guide for navigating. This would let the combo box
be built easily, if no text box is available, it uses the text "Slide
" & SlideIndex to fill the combo box for that page.

For anyone who likes the idea, an additional suggestion would be to
make the combobox wide and narrow and change the font properties to a
small font size so the combo box wouldn't really be overly obtrusive
on the screen.

Thanks for the original code Shyam.

Brian Reilly PowerPoint MVP

'''''''''''''''''''''''''Shyam's code modified for SlideMaster''''''''
Private Sub ComboBox1_Change()
'Place a combobox on the SlideMaster
'Name a text box for the Slide "Title"
Dim IDX As String


If ComboBox1.Text = "" Then Exit Sub
'Get the index of the slide since the GotoSlide requires an Index
IDX = ActivePresentation.Slides(ComboBox1.Text).SlideIndex

'Move to the slide
SlideShowWindows(1).View.GotoSlide (IDX)
ComboBox1.Text = ""
End Sub

Sub LoadCombo()
'Name a textbox shape "Title" on every page and use that for the
combobox text
Dim i As Integer
Dim strTitle As String
ComboBox1.Clear
For i = 1 To ActivePresentation.Slides.Count
On Error GoTo Err_No_shpTitle
strTitle =
ActivePresentation.Slides(i).Shapes("Title").TextFrame.TextRange.Text
Use_Slide_Name:
ActivePresentation.Slides(i).Name = strTitle
With ComboBox1
.AddItem strTitle
End With
Next i
Exit Sub
Err_No_shpTitle:
strTitle = "Slide " & ActivePresentation.Slides(i).SlideIndex
Resume Use_Slide_Name
End Sub

On Fri, 17 Nov 2000 12:50:49 -0600, "PTT, Inc." <ptt...@itexas.net>
wrote:

Sonia

unread,
Nov 17, 2000, 3:00:00 AM11/17/00
to
Do you know how old Shyam is? I doubt that he'll have any advice on this one, since the pitfalls of
age won't be Shyam's worry for a very long time <VBG>. However, I too wish I could grow up to be
like him. That's probably too much to ask, so I just wish that I would grow up!!

"PTT, Inc." <ptt...@itexas.net> wrote in message news:OY85DbMUAHA.243@cppssbbsa04...

Shyam Pillai

unread,
Nov 17, 2000, 9:52:21 PM11/17/00
to
Rob,
Adding some further comments to Brian's suggestion. If the combo box is set
to display all the slides then one could load all slide titles in the combo
box and use the ListIndex property of the combo box to navigate to the
appropriate slide on selection.

You should be aware that using ActiveX objects on the slides directly isn't
always advised if you intend to keep the presentation looping. It's known to
cause problems.
--
Regards
Shyam Pillai

http://officetips.homepage.com
--
"Brian Reilly, MS MVP" <br...@reillyand.com> wrote in message
news:3a1584a2...@msnews.microsoft.com...

Steve Rindsberg

unread,
Nov 18, 2000, 3:00:00 AM11/18/00
to
Oh, and folks ... the silly Florida.PPS file I attached earlier wasn't just
for giggles.
It's also a crude example of doing exactly what Shyam's talking about here.

--
Steve Rindsberg, PowerPoint MVP
Got a PowerPoint wish/suggestion/beef?
Email msw...@microsoft.com with PowerPoint in the subject line

Shyam Pillai <Sh...@Asia.com> wrote in message
news:em9bbrQUAHA.173@cppssbbsa04...

Rob Gould

unread,
Nov 20, 2000, 3:00:00 AM11/20/00
to
Thanks for all your help kind folk! That code works just as I want it, so I
can advance from here to make it suit my specific needs.

It is obvious that Shyam's knowledge is well beyond his years and we should
all have the desire to be like him when we grow up! *cough, splutter*.

Thanks again,

Seeya!

"Sonia" <so...@nowhere.com> wrote in message
news:ugcQ0PNUAHA.243@cppssbbsa03...

0 new messages