Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

vba - PowerPoint - Hide/Show Grouped Objects in Entire Presentation

I have a PowerPoint presentation with 156 slides. On each slide I have text boxes and shapes that I used the Group feature to band together then I labeled the group in the selection pane. I gave each group of shapes the same name on each slide. Right now the groups are visible on all of the slides, but there will times when these groups need to be hidden. Rather than going into each slide and manually hiding these groups via the selection pane, is there VBA I can add that would hide or show these groups in the entire presentation at once?

Update - I now have code that successfully shows and hides the specified shape group on the first slide when I run it:

Sub Numbers()

For i = 1 To 2

ActivePresentation.Slides(i).Shapes("Shape Group").Visible = msoTriStateToggle

Next

End Sub

To make this loop through the rest of the presentation, I added the following code:

Sub Numbers()

Dim sld As Slide

For Each sld In ActivePresentation.Slides

For i = 1 To 2
ActivePresentation.Slides(i).Shapes("Shape Group").Visible = 
msoTriStateToggle

Next

Next sld

End Sub

Now when I run this updated code, nothing happens. What's missing in this code?

question from:https://stackoverflow.com/questions/66054741/powerpoint-hide-show-grouped-objects-in-entire-presentation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...