powerpoint run macro every time presentation hits

2019-09-16 10:04发布

I am have a macro running in my powerpoint presentation (2007) to update all of the linked excel data. The macro works perfectly if I run it manually but I am trying to set it to run automatically every time the presentation gets back to the first slide.

I put the following code together after looking through a few similar questions here but it doesn't seem to work. Nothing happens when I hit slide 1.

Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = 1 Then

Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
oshp.LinkFormat.update
Next oshp
Next osld

End If
End Sub

anyone have any ideas?

1条回答
男人必须洒脱
2楼-- · 2019-09-16 10:11

Your code seems correct and should work, but PowerPoint sometimes doesn't properly implement OnSlideShowPageChange.

Adding an ActiveX control to the slide (even off-slide) usually solves the problem.

查看更多
登录 后发表回答