Reading Option Button (VBA) output

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Powerpoint 2003

I want to use a group of Option Button Controls (3) on a slide, but I can't
figure out how to read the output of the Option Button Grouping.
 
Powerpoint 2003

I want to use a group of Option Button Controls (3) on a slide, but I
can't figure out how to read the output of the Option Button Grouping.

If you put three option buttons on slide 1 named OptionButton1,
OptionButton2, and OptionButton3, then this code will tell you which one
is selected:

Public Sub whichbutton()
If Slide1.OptionButton1.Value = -1 Then
MsgBox "It's the first one"
ElseIf Slide1.OptionButton2.Value = -1 Then
MsgBox "It's the second one"
ElseIf Slide1.OptionButton3.Value = -1 Then
MsgBox "It's the third one."
End If
End Sub


--
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/
 
Thanks it worked great.

--
Tom Conrad


David M. Marcovitz said:
If you put three option buttons on slide 1 named OptionButton1,
OptionButton2, and OptionButton3, then this code will tell you which one
is selected:

Public Sub whichbutton()
If Slide1.OptionButton1.Value = -1 Then
MsgBox "It's the first one"
ElseIf Slide1.OptionButton2.Value = -1 Then
MsgBox "It's the second one"
ElseIf Slide1.OptionButton3.Value = -1 Then
MsgBox "It's the third one."
End If
End Sub


--
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/
 
Tom,
Alternatively to David's fine suggestion, you might consider adding
code to the Click Event, not sure of your specific needs.

The following two methods would do that. The first is attached to the
Click of an OptionButton.
The second is attached to the Click of the OK button.

Many ways to get the same result.

Brian Reilly, MVP
 
I'm also have diffculty with option buttons. (PP2003) They are currently
keeping their value after the presentation is over. I attempted writing the
following code to intialize their values, but it still does not work:
Sub SetupQQ()
Slide12.QQ1T.Value = 0
Slide12.QQ1F.Value = 0
Slide12.QQ2T.Value = 0
Slide12.QQ2F.Value = 0
Slide12.QQ3T.Value = 0
Slide12.QQ3F.Value = 0
Slide12.QQ4T.Value = 0
Slide12.QQ4F.Value = 0
Slide12.QQ5T.Value = 0
Slide12.QQ5F.Value = 0
Slide13.QQ6T.Value = 0
Slide13.QQ6F.Value = 0
Slide13.QQ7T.Value = 0
Slide13.QQ7F.Value = 0
Slide13.QQ8T.Value = 0
Slide13.QQ8F.Value = 0
Slide13.QQ9T.Value = 0
Slide13.QQ9F.Value = 0
Slide13.QQ10T.Value = 0
Slide13.QQ10F.Value = 0
ActivePresentation.SlideShowWindow.View.GotoSlide 12
End Sub

Why are you using -1 for the value?
 
Back
Top