以编程方式在 PowerPoint VBA 中获取 previous/next 动画
Programmatically get previous/next animation in PowerPoint VBA
我正在尝试通过 PowerPoint 中的操作按钮控制幻灯片动画 VBA。我设法使用 sendKeys
导航到当前幻灯片中的下一个和上一个动画。
动作按钮基本上运行s displayPrevious
和displayNext
宏如下:
Sub displayPrevious()
SendKeys ("{LEFT}")
End Sub
Sub displayNext(ByRef oShp As Shape)
SendKeys ("{RIGHT}")
End Sub
但是,这会导致不需要的功能。在最后一个动画之后,下一个按钮切换下一张或上一张幻灯片。
我想这样做的一种方法可能是,执行下一张或上一张幻灯片,如果是更改幻灯片,则不要 运行 sendkeys
。
或者我的想法不对,有更简单的解决方案吗?
终于设法找到了一个(可行但不完美的)解决方案。
基本上只是检查从 getClickIndex
开始播放的当前动画,并与上一个 0
和下一个 getClickCount
进行比较。
Sub displayPrevious()
If ActivePresentation.SlideShowWindow.View.GetClickIndex <> 0 Then
SendKeys ("{LEFT}")
End If
End Sub
Sub displayNext()
If ActivePresentation.SlideShowWindow.View.GetClickIndex <> ActivePresentation.SlideShowWindow.View.GetClickCount Then
SendKeys ("{RIGHT}")
End If
End Sub
我正在尝试通过 PowerPoint 中的操作按钮控制幻灯片动画 VBA。我设法使用 sendKeys
导航到当前幻灯片中的下一个和上一个动画。
动作按钮基本上运行s displayPrevious
和displayNext
宏如下:
Sub displayPrevious()
SendKeys ("{LEFT}")
End Sub
Sub displayNext(ByRef oShp As Shape)
SendKeys ("{RIGHT}")
End Sub
但是,这会导致不需要的功能。在最后一个动画之后,下一个按钮切换下一张或上一张幻灯片。
我想这样做的一种方法可能是,执行下一张或上一张幻灯片,如果是更改幻灯片,则不要 运行 sendkeys
。
或者我的想法不对,有更简单的解决方案吗?
终于设法找到了一个(可行但不完美的)解决方案。
基本上只是检查从 getClickIndex
开始播放的当前动画,并与上一个 0
和下一个 getClickCount
进行比较。
Sub displayPrevious()
If ActivePresentation.SlideShowWindow.View.GetClickIndex <> 0 Then
SendKeys ("{LEFT}")
End If
End Sub
Sub displayNext()
If ActivePresentation.SlideShowWindow.View.GetClickIndex <> ActivePresentation.SlideShowWindow.View.GetClickCount Then
SendKeys ("{RIGHT}")
End If
End Sub