1
votes

I’m trying to create a free non-editable version of a PowerPoint slide that demonstrates how VBA can be used to make a slide very dynamic. The slide is an interactive stopwatch and there is a video of it here:

http://i-present.co.uk/free-stuff/free-powerpoint-stopwatch/

VBA is used to modify various shapes on the slide based on the Windows API timer.

In the free version, I want the VBA functionality to run but set the presentation up so that the slide objects cannot be edited.

This is what I’ve tried so far:

1 - Setting a modify password on a ppsm version of the file. Problem : VBA cannot modify the properties of objects on the slide when the presentation is opened in read only mode.

2 - Using VBA to save a temporary write version of the file. Problem : once the presentation is opened as read only, it doesn’t appear to be possible to use VBA to provide the password and then save as a modifiable file.

3 - Creating a separate ppsm file which has a single shape on it, with an Action to run a macro to open the password protected stopwatch deck. Problem : the VBA code to open a password protected presentation (available since PowerPoint 2010) causes PowerPoint 2013 to crash:

Dim oPVW As ProtectedViewWindow
Dim oPres As Presentation
Set oPVW = ProtectedViewWindows.Open(FileName, ReadPassword)
Set oPres = PVW.Edit(ModifyPassword)

4 - Embedded the stopwatch ppsm file within another presentation as a slide object so that the user can click on it but not save and edit it. Problem : spawning a slide show from an embedded object causes the VBA code to not run.

Doe anyone have any ideas how the need can be addressed?

2
7 years later, I'm fooling around with this code and have concluded that the MS help page is wrong. Using ProtectedViewWindows.Edit with ModifyPassword does not reset the password, it supplies the password to allow modification. After supplying the password, the ActivePresentation keyword starts to work to make changes to the file. After saving and closing the file still has the original modification password.John Korchok

2 Answers

1
votes

Well howdy, Mr.ChromeBumpers

One approach:

Let them edit the shape to their heart's content. But warn them that if they do, your code will decline to run.

Your code can test any combination of the shape's properties you like: Height, width, top, left, color, text and so on. And refuse to run if even one of those properties has been altered from the shape as supplied by you.

0
votes

Here is code in Excel that opens a password protected PowerPoint file. Replace the password with your actual password. This has worked in 2010, 2016 and 365 office.

Dim PPTObj As Object
Set PPTObj = CreateObject("PowerPoint.application")
PPTObj.Presentations.Open ("C:\PowerPoint\PW_prot_file.pptm:password::")