How to provide VBA access for a modify password protected read only PowerPoint file?

StackOverflow https://stackoverflow.com/questions/21827650

  •  12-10-2022
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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::")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top