我正在尝试在Powerpoint中借助vbscript删除动画。 但是它应该只从选定的幻灯片中删除,而不是从所有幻灯片中删除
我尝试了一些代码,但是它已从示例代码下面共享的所有幻灯片中删除,任何人都可以帮助我解决该问题
Sub RemoveAllAnimations()
'PURPOSE: Remove All PowerPoint Animations From Slides
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault
Dim sld As Slide
Dim x As Long
Dim Counter As Long
'Loop Through Each Slide in ActivePresentation
For Each sld In ActivePresentation.Slides
'Loop through each animation on slide
For x = sld.TimeLine.MainSequence.Count To 1 Step -1
'Remove Each Animation
sld.TimeLine.MainSequence.Item(x).Delete
'Maintain Deletion Stat
Counter = Counter + 1
Next x
Next sld
'Completion Notification
MsgBox Counter & " Animation(s) were removed from you PowerPoint presentation!"
End Sub
从所有幻灯片中删除动画
答案 0 :(得分:1)
仅针对所选幻灯片:
Sub RemoveAllAnimations()
Dim sld As Slide
Dim x As Long
Dim Counter As Long
Set sld = ActiveWindow.View.Slide
For x = sld.TimeLine.MainSequence.Count To 1 Step -1
sld.TimeLine.MainSequence.Item(x).Delete
Counter = Counter + 1
Next x
Set sld = Nothing
MsgBox Counter & " Animation(s) were removed from your PowerPoint presentation!"
End Sub