0
我想删除带有动画的形状以在没有它们的情况下拍摄幻灯片。之后,我希望他们回来,所以我使用撤消命令。问题在于这个命令是迟到的。我的意思是说,当我所有的vba代码都结束时,它会进行撤销,而当我调用该命令时,我需要它来执行撤消操作。我试图停止代码几秒钟,但不工作。下面是我使用的代码:撤销命令工作如此之晚
For Each sl In ActivePresentation.Slides
shapeNum = sl.Shapes.count
'ActivePresentation.Slides(1).Shapes(1).
While shapeNum <> 0
If sl.Shapes(shapeNum).AnimationSettings.Animate = msoTrue Then
animationNum = animationNum + 1
sl.Shapes(shapeNum).Delete
animationNum = animationNum + 1
End If
shapeNum = shapeNum - 1
Wend
Next
ActivePresentation.SaveAs "c:\dink_template\created_files", ppSaveAsPNG, msoTrue
If animationNum <> 0 Then
Application.CommandBars.ExecuteMso "Undo"
'to make the code stop for 5 seconds
waitTime = 5
Start = Timer
While Timer < Start + waitTime
Wend
End If
' Here the code continues doing several things
我也尝试把一个MsgBox或另一种方式来阻止我在这里看到:http://www.pptfaq.com/FAQ00466_Put_your_macro_to_Sleep.htm
但没有任何工程它留5秒做什么,但撤消直到我完成代码才能工作。有用的是使用调试器。如果我用调试器停止它的工作,但我想在不使用调试器的情况下执行它,因为当我将代码作为宏使用时,我将无法使用它。