PDA

View Full Version : option button show/hide group of fields



eugzl
12-29-2015, 07:47 PM
The slide has 2 option button Yes and No. I would like to show or hide group of TextBox in dependence which option button is selected. For instance, if selected optYes display TextBox1,2,3 and TextBox4,5,6 is hidden. And wise averse if selected optNo display TextBox4,5,6 and TextBox1,2,3 is hidden. How to do it in VBA?

Paul_Hossler
12-29-2015, 08:44 PM
This is on the Slide's code module and is very not general purpose

You can look at the attached file and see if it helps




Option Explicit
Private Sub CommandButton1_Click()
With Me
.Shapes("Textbox 1").Visible = msoTrue
.Shapes("Textbox 2").Visible = msoTrue
.Shapes("Textbox 3").Visible = msoTrue
.Shapes("Textbox 4").Visible = msoFalse
.Shapes("Textbox 5").Visible = msoFalse
.Shapes("Textbox 6").Visible = msoFalse
End With
End Sub

Private Sub CommandButton2_Click()
With Me
.Shapes("Textbox 1").Visible = msoFalse
.Shapes("Textbox 2").Visible = msoFalse
.Shapes("Textbox 3").Visible = msoFalse
.Shapes("Textbox 4").Visible = msoTrue
.Shapes("Textbox 5").Visible = msoTrue
.Shapes("Textbox 6").Visible = msoTrue
End With
End Sub

eugzl
12-30-2015, 09:05 AM
Hi Paul_Hossler. Thanks for replay.

Based on your post in PowerPoint doesn't exists procedure to show/hide object by click option button. Is that correct? And other question. I inserted to slide the Storyboard Shapes, for instance, DatePicker and icon Calendar and also would like to show/hide based on click option button. How to do it?

Thanks.

Paul_Hossler
12-30-2015, 01:45 PM
The only way I know to hide shapes is using something like the macro in the attached file.

In slideshow mode, one button will hide 1,2, and 3 and the othe button will hide 4, 5, and 6

DatePicker and icon Calendar would have to be included in the two macros