我有一个宏应该可以使页面上的每个形状都可见(我有其他的宏使它们不可见)。这是代码:
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年。
答案 0 :(得分:0)
您的代码无法正常显示。我把它改成了这个,它在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