PowerPoint 2013 宏运行缓慢 (重绘问题?)



我有一个宏,它应该使页面上的每个形状都可见(我还有其他宏使它们不可见)。这是代码:

Dim Slide As Integer
Slide = SSW.View.CurrentShowPosition
If Slide = 1 Then
    For Each shp In ActivePresentation.Slides(2).Shapes
        shp.Visible = True
    Next shp
End if

此宏需要永远运行。我怀疑这是因为每次使形状可见时,它都会重绘屏幕。

这不是必需的,事实上,当运行此宏时,幻灯片甚至不会显示在屏幕上(它在幻灯片 1 上运行,但使幻灯片 2 上的形状可见)。有没有办法让它运行得更快?禁用屏幕刷新或其他什么?

我从 http://www.vbaexpress.com/forum/showthread.php?33671-Solved-PP2010-ScreenUpdating-False 尝试了 Shyam 的解决方案,但它不起作用。他只到2010年,我使用的是2013年。

您的代码无法按所示工作。 我把它改成这样,它几乎可以立即在具有 175 个形状的幻灯片上工作:

' Put this at the top of every module; builds character, keeps you out of trouble
Option Explicit  
Sub ThisWorks()
' Always dim ALL variables
Dim Slide As Long   ' SlideIndex is a Long, not an Integer
Dim oSh As Shape
' Replaced your SSW with this:
Slide = SlideShowWindows(1).View.CurrentShowPosition
If Slide = 1 Then
    For Each oSh In ActivePresentation.Slides(2).Shapes
        ' I was toggling them back and forth as a test
        ' oSh.Visible = Not oSh.Visible
        oSh.Visible = True
    Next
End If
' Delete this when it's no longer needed
MsgBox "Done"
End Sub

最新更新