Option Button cleared

P

Project Org

I have a powerpoint slide with 30 option buttons. Each option button
represents a different department and I want the person to be able to choose
the department that they work in.

2 things: How do I get the Option button to clear so the next person who
starts the test will not see any option button as being choosen? Right now
the last choice made is still there when you open Powerpoint.
The second thing: what is the code to get powerpoint to remember which
option button that was picked and print that out on the certificate page at
the end of the powerpoint program. I have a printable slide at the end of the
test.

Any help is appreciated.
 
D

David M. Marcovitz

In your main module, you will need to declare a public variable to keep
track of which option button was clicked:

Public theOption

This could be used in the procedure that creates your printable slide. As
a simple example, you could just pop up a MsgBox to tell you what was
clicked:

Sub WhichOption()
MsgBox theOption
End Sub

You will also need a procedure that resets the options buttons. If the
buttons appear on slide 1, something like this will work (this example
handles two option buttons that haven't been renamed, but you can
obviously addm more):

Sub StartAgain()
Slide1.OptionButton1.Value = False
Slide1.OptionButton2.Value = False
End Sub

You might also want to add something to reset the value of the theOption
variable (theOption = 0 or theOption = "").

Next, you will need something in the slide's module, such as:

Private Sub OptionButton1_Click()
theOption = 1
End Sub

Private Sub OptionButton2_Click()
theOption = 2
End Sub

In this example (again with 2 buttons that could be more), I use numbers
to keep track of which button was selected, but you could put words in
there (such as theOption = "George Washington").

This is just one way to do this. It checks out which button was chosen
when the button was clicked. You could also search through all the option
buttons at the end to see which Value is True, but I would probably do it
this way.

--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.loyola.edu/education/PowerfulPowerPoint/
 

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