Powerpoint SlideShowBegin won't fire

T

timonardo

I have the following VBA code attached in a PowerPoint 2010 macro-enabled presentation:


Public CurrentSlideIndex As Integer

Sub OnSlideShowPageChange()
CurrentSlideIndex = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If CurrentSlideIndex = 1 Then
MsgBox "First Page"
' some initialization
End If
End Sub


I want to do some initialization there when the first page is shown. The problem is that when I run the presentation for the first time, the routine is not fired. I need to stop presentation and run it the second time, then it work - and keeps working afterward also. Only the first run doesn't work.

I've tried adding something like following in a class module:

Public WithEvents App As Application
Private Sub App_SlideShowBegin(ByVal Wn As SlideShowWindow)
MsgBox "SlideShowBegin"
End Sub


But that doesn't seem to run either.

Pom
 
Joined
Aug 21, 2017
Messages
1
Reaction score
0
(I found that it works for me in powerpoint 2016)

Create a module and paste:


'Start
Dim j As Integer

Sub onslideshowpagechange()
Dim i As Integer
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
If (i = 1) And (Not (j = 1)) Then
procedurehello
j = 1
End If
End Sub

Sub OnSlideShowTerminate()
j = 0
End Sub

Sub procedurehello()

'Do it only once at the beginning, do your initialization
MsgBox "Helloworld"

End Sub
'End
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top