更改滑动范围的形状可见特性(VBA宏PowerPoint)
问题描述:
我测试了以下代码,以更改阵列中每张幻灯片中所有形状的可见性(“a”):更改滑动范围的形状可见特性(VBA宏PowerPoint)
Private Sub CommandButton1_Click()
Dim osldR As SlideRange
Set osldR = ActivePresentation.slides.Range(Array(2, 3, 4))
osldR.Shapes("a").Visible = msoFalse
End Sub
但我得到this error。
答
尝试...
Private Sub CommandButton1_Click()
Dim osldR As SlideRange
Dim oSld As Slide
Dim oShp As Shape
Set osldR = ActivePresentation.Slides.Range(Array(2, 3, 4))
For Each oSld In osldR
For Each oShp In oSld.Shapes
If oShp.Name = "a" Then
oShp.Visible = msoFalse
Exit For 'if there will only be one shape named "a" on a slide
End If
Next oShp
Next oSld
End Sub
希望这有助于!
它工作,谢谢! –