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

Vba PowerPoint 2013宏运行缓慢(重画问题?),vba,powerpoint,Vba,Powerpoint,我有一个宏,可以使页面上的每个形状都可见(我还有其他宏可以使它们不可见)。代码如下: 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 此宏需要永远运行。我怀疑这是因为每次形状可见时,它都会

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

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上的形状可见)。有没有办法让这跑得更快?禁用屏幕刷新还是什么


我试过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

代码不起作用的原因是我忘记包含将SSW变量设置为SlideShowWindows(1)的行。我现在不在工作,我明天会试用你的新代码,并让你知道它是否有效。谢谢