PDA

View Full Version : VBA not getting executed in .ppsm file



VNJ
05-22-2017, 05:53 AM
Hello,

I have following VBA code in powerpoint 2007:


Sub OnSlideShowPageChange()
On Error GoTo ErrLog
Dim i As Integer

If Format(Date, "dd/mm/yyyy") = Format(CDate("21/5/2017")) Then
'Run the Slide
msgbox "Running"
Else
msgbox "Exiting"
ActivePresentation.SlideShowWindow.View.Exit
End If
Exit Sub

ErrLog:
MsgBox Err.Description
End Sub

i..e I want that this powerpoint .ppsm file run only on 21st May 2017. On other dates, it should exit. I save my pptm file and also saved in .ppsm format. When my pptm file is open, and I run .ppsm file from Windows Explorer, VBA code executes. But if I exit my .pptm file and then run .ppsm file from Windows Explorer, VBA code does not execute. Why?

Please Help....

John Wilson
05-24-2017, 01:11 PM
The method you are using is from PPT 97 and it is not reliable. You can help by inserting any object from the control toolbox (Say an activX command button ) on slide 1 and set it to not visible with the selection pane.