萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 辦公室軟體 >  >> PowerPoint 教學 >> PPT 進階技巧

一鍵清除 PPT 所有動畫:VBA 宏代碼完整分享

PPT 原生無「一鍵清除所有動畫」功能,逐頁手刪動輒上百頁極其痛苦。經全網搜尋,最終找到 VBA 解決方案,分享完整代碼:

Sub removeALL()
Dim I As Integer: Dim J As Integer
Dim oActivePres As Object
Set oActivePres = ActivePresentation
With oActivePres
    For I = 1 To .Slides.Count
        If Val(Application.Version) < 10 Then
            For J = 1 To .Slides(I).Shapes.Count
                .Slides(I).Shapes(J).AnimationSettings.Animate = msoFalse
            Next J
        Else
            For J = .Slides(I).TimeLine.MainSequence.Count To 1 Step -1
                .Slides(I).TimeLine.MainSequence(J).Delete
            Next J
        End If
    Next I
End With
Set oActivePres = Nothing
End Sub

使用方法:Alt+F11 打開 VBA 編輯器 → 插入模組 → 貼上代碼 → 關閉編輯器 → Alt+F8 運行 removeALL 宏。兼容 PPT 2003(版本號<10)與 2007/2010/2013+ 版本,自動遍歷所有投影片清除動畫。

copyright © 萬盛學電腦網 all rights reserved