Sub ShowContent()
Dim i As Integer
Dim btn As Shape
' 循环遍历所有形状,找到其中的按钮
For Each btn In ActivePresentation.Slides(1).Shapes
If TypeName(btn) = "Button" Then
' 如果当前按钮是被选中的按钮,则显示其对应的内容
If btn.Selected Then
Set content = ActivePresentation.Slides(1).Shapes("Content")
content.Visible = True
End If
ElseIf TypeName(btn) = "GroupBox" Then
' 如果当前按钮是包含内容的组框,则显示其对应的内容
If btn.GroupItems.Count > 0 Then
Set content = btn.GroupItems(1).Placement.TopLeftCell.Offset(0, btn.Height + btn.Width / 2 - content.Height / 2).Shapes("Content")
content.Visible = True
End If
End If
Next btn
End Sub
追问大神你好!你写VBA代码我刚才试过了,没反应,不知道是哪里的问题。
我可以把PPT文件发过去,你给看看吗?