Combo Box

M

Mr.ChrisKelley

Hi all,

What I'm trying to do is populate 3 combo boxes located on the master
slide based on the property of 3 radio buttons located on slide 1.
What I've done is recorded a macro and set it to run a procedure with
the following code (the code is located on the master slide code):

Sub LoadComboComboBox1()
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton1 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End Sub

I can't get it to run. Any help would be greaty appreciated.

Thanks,

Chris
 
S

Steve Rindsberg

"Can't get it to run" covers a wide swath.

Does it simply never run at all?
What's supposed to trigger the macro TO run?

Do you get error messages when it runs?
What do they say? What line do they occur on?

Here, at least, I'd guess:

If ComboBox1.ListCount < 5 And

VBA won't know where that combobox is. You'll need something like:

With ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
If .ListCount < 5 and ' etc etc etc

.AddItem "Artist"
' and so on
 
M

Mr.ChrisKelley

"Can't get it to run" covers a wide swath.

Does it simply never run at all?
What's supposed to trigger the macro TO run?

Do you get error messages when it runs?
What do they say? What line do they occur on?

Here, at least, I'd guess:

If ComboBox1.ListCount < 5 And

VBA won't know where that combobox is. You'll need something like:

With ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
If .ListCount < 5 and ' etc etc etc

.AddItem "Artist"
' and so on






-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.
 
D

David M. Marcovitz

(e-mail address removed) wrote in @q3g2000prf.googlegroups.com:
Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.

A quick glance shows that you have a long string of ElseIf statements.
That means that only one (at most) will run. Also, your only checking the
value of OptionButton1 and, sometimes, OptionButton2, but you said you
have three. When would you expect to ask about the value of #3?
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
E

Echo S

Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.

I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so the
problem could lie there. Instead, give the shape a fill and make it 99%
transparent. Even at 99% it won't be visible, but it should work.

--
Echo [MS PPT MVP] http://www.echosvoice.com
What's new in PowerPoint 2007? http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/2qzlpl
Fixing PowerPoint Annoyances
http://www.oreilly.com/catalog/powerpointannoy/index.html
PPTLive! Oct 28-31, New Orleans http://www.pptlive.com
 
M

Mr.ChrisKelley

(e-mail address removed) wrote in @q3g2000prf.googlegroups.com:





A quick glance shows that you have a long string of ElseIf statements.
That means that only one (at most) will run. Also, your only checking the
value of OptionButton1 and, sometimes, OptionButton2, but you said you
have three. When would you expect to ask about the value of #3?
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_http://www.PowerfulPowerPoint.com/

Yes, I have 3 but I haven't taken the time to add it in because I
didn't know if I could get it working.
 
M

Mr.ChrisKelley

Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.

I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so the
problem could lie there. Instead, give the shape a fill and make it 99%
transparent. Even at 99% it won't be visible, but it should work.

--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint 2007?http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover Kithttp://tinyurl.com/2qzlpl
Fixing PowerPoint Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.html
PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com

Here's my updated code located on the master slide. My option buttons
and the macro are located on slide 1. So should my code go on slide 1
or the master slide?

Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Object
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub

Thanks for the help.

Chris
 
M

Mr.ChrisKelley

I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so the
problem could lie there. Instead, give the shape a fill and make it 99%
transparent. Even at 99% it won't be visible, but it should work.
--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint 2007?http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover Kithttp://tinyurl.com/2qzlpl
Fixing PowerPoint Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.html
PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com

Here's my updated code located on the master slide. My option buttons
and the macro are located on slide 1. So should my code go on slide 1
or the master slide?

Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Object
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub

Thanks for the help.

Chris

OK, this code isn't working at all. I don't have any event handlers
or traps because I don't know how to do them. I thought the macro
should take care of that.
 
M

Mr.ChrisKelley

On Oct 22, 11:13 am, "Echo S" <[email protected]>
wrote:
Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.
I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so the
problem could lie there. Instead, give the shape a fill and make it 99%
transparent. Even at 99% it won't be visible, but it should work.
--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint 2007?http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover Kithttp://tinyurl.com/2qzlpl
Fixing PowerPoint Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.html
PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com
Here's my updated code located on the master slide. My option buttons
and the macro are located on slide 1. So should my code go on slide 1
or the master slide?
Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Object
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
Thanks for the help.

OK, this code isn't working at all. I don't have any event handlers
or traps because I don't know how to do them. I thought the macro
should take care of that.

OK, I got it! Here's what I was looking for:

Sub LoadComboComboBox1()
With ActivePresentation.Slides(1)

If .Shapes("OptionButton1").OLEFormat.Object.Value = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"

Else: .Shapes("OptionButton2").OLEFormat.Object.Value = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub

I do have one more question. Since I'm using a macro with mouse over,
every time the user pases over the shape it will clear the combo box
even if it has the right stuff in it. Any ideas on how to prevent
that? Basically if the combo box already has the items it's supposed
to then I want it to do nothing (i.e. not clear the contents so the
user has to select them again).

Thanks for all the help!

Chris
 
D

David M. Marcovitz

(e-mail address removed) wrote in
On Oct 22, 11:13 am, "Echo S" <[email protected]>
wrote:
Well, it seems like it actually runs, but it only seems to
respond to one option button. I have a transparent auto shape
that on mouse over is supposed to fire the macro.
I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so
the problem could lie there. Instead, give the shape a fill and
make it 99% transparent. Even at 99% it won't be visible, but it
should work.
--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint 2007?http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover
Kithttp://tinyurl.com/2qzlpl Fixing PowerPoint
Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.htm
l PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com
Here's my updated code located on the master slide. My option
buttons and the macro are located on slide 1. So should my code go
on slide 1 or the master slide?
Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Object
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
Thanks for the help.

OK, this code isn't working at all. I don't have any event handlers
or traps because I don't know how to do them. I thought the macro
should take care of that.

OK, I got it! Here's what I was looking for:

Sub LoadComboComboBox1()
With ActivePresentation.Slides(1)

If .Shapes("OptionButton1").OLEFormat.Object.Value = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"

Else: .Shapes("OptionButton2").OLEFormat.Object.Value = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub

I do have one more question. Since I'm using a macro with mouse over,
every time the user pases over the shape it will clear the combo box
even if it has the right stuff in it. Any ideas on how to prevent
that? Basically if the combo box already has the items it's supposed
to then I want it to do nothing (i.e. not clear the contents so the
user has to select them again).

Thanks for all the help!

Chris

I'm glad you got it working. I guess you need another If condition to
test if the right stuff is in the ComboBox. Alternatively, if the Option
Buttons won't change from one mouseover to the next, you could set the
contents of a varialble to say that you're done and check that variable
in your added If condition.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
M

Mr.ChrisKelley

(e-mail address removed) wrote in

On Oct 22, 11:35 am, (e-mail address removed) wrote:
On Oct 22, 11:13 am, "Echo S" <[email protected]>
wrote:

Well, it seems like it actually runs, but it only seems to
respond to one option button. I have a transparent auto shape
that on mouse over is supposed to fire the macro.
I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly -- so
the problem could lie there. Instead, give the shape a fill and
make it 99% transparent. Even at 99% it won't be visible, but it
should work.
--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint 2007?http://www.echosvoice.com/2007.htm
(New!) The PowerPoint 2007 Complete Makeover
Kithttp://tinyurl.com/2qzlplFixing PowerPoint
Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.htm
l PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com
Here's my updated code located on the master slide. My option
buttons and the macro are located on slide 1. So should my code go
on slide 1 or the master slide?
Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Object
And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Object
If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
Thanks for the help.
Chris
OK, this code isn't working at all. I don't have any event handlers
or traps because I don't know how to do them. I thought the macro
should take care of that.
OK, I got it! Here's what I was looking for:
Sub LoadComboComboBox1()
With ActivePresentation.Slides(1)
If .Shapes("OptionButton1").OLEFormat.Object.Value = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
Else: .Shapes("OptionButton2").OLEFormat.Object.Value = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
I do have one more question. Since I'm using a macro with mouse over,
every time the user pases over the shape it will clear the combo box
even if it has the right stuff in it. Any ideas on how to prevent
that? Basically if the combo box already has the items it's supposed
to then I want it to do nothing (i.e. not clear the contents so the
user has to select them again).
Thanks for all the help!

I'm glad you got it working. I guess you need another If condition to
test if the right stuff is in the ComboBox. Alternatively, if the Option
Buttons won't change from one mouseover to the next, you could set the
contents of a varialble to say that you're done and check that variable
in your added If condition.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_http://www.PowerfulPowerPoint.com/

That's what I was thinking. What's the object property of the combo
box that would check its contents? Something like
ComboBox1.Value="Name" "Artist" etc etc
 
D

David M. Marcovitz

(e-mail address removed) wrote in
(e-mail address removed) wrote
in

On Oct 22, 11:42 am, (e-mail address removed) wrote:
On Oct 22, 11:35 am, (e-mail address removed) wrote:
On Oct 22, 11:13 am, "Echo S"
<[email protected]> wrote:
Well, it seems like it actually runs, but it only seems to
respond to one option button. I have a transparent auto
shape that on mouse over is supposed to fire the macro.
I don't know anything about the macro, but 100% transparent or
no-line/no-fill autoshapes don't always hold links properly --
so the problem could lie there. Instead, give the shape a fill
and make it 99% transparent. Even at 99% it won't be visible,
but it should work.
--
Echo [MS PPT MVP]http://www.echosvoice.com
What's new in PowerPoint
2007?http://www.echosvoice.com/2007.htm (New!) The PowerPoint
2007 Complete Makeover Kithttp://tinyurl.com/2qzlplFixing
PowerPoint
Annoyanceshttp://www.oreilly.com/catalog/powerpointannoy/index.
htm l PPTLive! Oct 28-31, New Orleanshttp://www.pptlive.com
Here's my updated code located on the master slide. My option
buttons and the macro are located on slide 1. So should my code
go on slide 1 or the master slide?
Sub LoadComboComboBox1()
With
ActivePresentation.SlideMaster.Shapes("ComboBox1").OLEFormat.Obje
ct And
ActivePresentation.SlideMaster.Shapes("ComboBox2").OLEFormat.Obje
ct And
ActivePresentation.SlideMaster.Shapes("ComboBox3").OLEFormat.Obje
ct If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
Else: ActivePresentaton.Slides(1).OptionButton2 = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
Thanks for the help.

OK, this code isn't working at all. I don't have any event
handlers
or traps because I don't know how to do them. I thought the macro
should take care of that.
OK, I got it! Here's what I was looking for:
Sub LoadComboComboBox1()
With ActivePresentation.Slides(1)
If .Shapes("OptionButton1").OLEFormat.Object.Value = True Then
ComboBox1.Clear
ComboBox1.AddItem "Artist"
ComboBox1.AddItem "Album"
ComboBox1.AddItem "Song"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Format"
ComboBox2.Clear
ComboBox2.AddItem "Artist"
ComboBox2.AddItem "Album"
ComboBox2.AddItem "Song"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Format"
ComboBox3.Clear
ComboBox3.AddItem "Artist"
ComboBox3.AddItem "Album"
ComboBox3.AddItem "Song"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Format"
Else: .Shapes("OptionButton2").OLEFormat.Object.Value = True
ComboBox1.Clear
ComboBox1.AddItem "Name"
ComboBox1.AddItem "Time"
ComboBox1.AddItem "Year"
ComboBox1.AddItem "Genre"
ComboBox1.AddItem "Rating"
ComboBox2.Clear
ComboBox2.AddItem "Name"
ComboBox2.AddItem "Time"
ComboBox2.AddItem "Year"
ComboBox2.AddItem "Genre"
ComboBox2.AddItem "Rating"
ComboBox3.Clear
ComboBox3.AddItem "Name"
ComboBox3.AddItem "Time"
ComboBox3.AddItem "Year"
ComboBox3.AddItem "Genre"
ComboBox3.AddItem "Rating"
End If
End With
End Sub
I do have one more question. Since I'm using a macro with mouse
over, every time the user pases over the shape it will clear the
combo box even if it has the right stuff in it. Any ideas on how
to prevent that? Basically if the combo box already has the items
it's supposed to then I want it to do nothing (i.e. not clear the
contents so the user has to select them again).
Thanks for all the help!

I'm glad you got it working. I guess you need another If condition to
test if the right stuff is in the ComboBox. Alternatively, if the
Option Buttons won't change from one mouseover to the next, you could
set the contents of a varialble to say that you're done and check
that variable in your added If condition.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for
Educators_http://www.PowerfulPowerPoint.com/

That's what I was thinking. What's the object property of the combo
box that would check its contents? Something like
ComboBox1.Value="Name" "Artist" etc etc

ActivePresentation.Slides(1).Shapes("ComboBox1").OLEFormat.Object.List(0)

returns the first value in the combobox. Change the 0 to 1 and 2 and 3
and ... to get the rest of the values.

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
S

Steve Rindsberg

That's what I was thinking. What's the object property of the combo
box that would check its contents? Something like
ComboBox1.Value="Name" "Artist" etc etc

ActivePresentation.Slides(1).Shapes("ComboBox1").OLEFormat.Object.Text
 
S

Steve Rindsberg

If ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton1 = True Then

do some stuff
ElseIf ActivePresentaton.Slides(1).OptionButton1 = True Then
do some stuff
ElseIf ComboBox1.ListCount < 5 And
ActivePresentaton.Slides(1).OptionButton2 = True Then
do some stuff
Else: ActivePresentaton.Slides(1).OptionButton1 = True
this will SET optionbutton 1 true
Is that what you want?
End If

If ListCount >= 5 OptionButton1 is the only one it'll respond to
If ListCount < 5 then it could respond to OptionButton2
Well, it seems like it actually runs, but it only seems to respond to
one option button. I have a transparent auto shape that on mouse over
is supposed to fire the macro.

I'd set a breakpoint at the first IF statement and trace it through as it fires
under various conditions. It should be easy enough to see where it goes
off-track from what you expect
 

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