0
votes

My colleague and I have been on a six month quest for a VBA macro that can run in a Read-Only, password protected PowerPoint.

Is it possible or will PowerPoint always block the VBA macro from running in the presentation, because of the read-only status?

Private Sub CheckBox1_Click()
Dim ppShp As Shape
Dim eff1 As Effect
Dim ani1 As AnimationBehavior
With ActivePresentation.Slides(1)
    Set ppShp = .Shapes("Oval 4")
    Set eff1 = .TimeLine.MainSequence.AddEffect(Shape:=ppShp, effectId:=msoAnimEffectAppear)
End With

End Sub

I tried using If ReadOnly = True Then conditions.

I want the user to use the macros and save, but not edit beyond that, or to open and 'look under the hood'.

(It's all for an educational program)

We get

Run-time error '-2147467259 (80004005)'
Presentation (unknown member) : Invalid request. Presentation cannot be modified.

2
Do you know the password? If not then no you certainly can't do anything with it - Nick.McDermaid
Thanks for your response. Yes, it’s my own password and PPT. Though I want to make it for people who don’t and will not have the password. I want them to use the macros, but not unlock. - Madpoet88
First see if your code works on a non read-only PPT without a password. Is the macro inside the read only pwd protected document, or is it external? ready/only and pwd protection is not serious protection. It's easy to crack - Nick.McDermaid
Yes the macro works otherwise. It's internal, as in it can be viewed within the developer tab VBA coding view-sheet. Is there a way of accomplishing what I'm after by making the VBA code external?? - Madpoet88
Yes you can make your code external. For example you can create a compiled VB6 app. You can create in in .Net (using COM Interop). You could do it in VBScript. You could put it in a seperate Excel file. Any language that can use COM objects. So is it the read only aspect or the password aspect that is causing the error? Narrow it down. You should understand that it is trivial to overcome Office password protection. It's not a real protection method. - Nick.McDermaid

2 Answers

0
votes

Perhaps as a work around you could save a copy of the original read only presentation, run your macro on the new version and then save the new version as read only?

0
votes

Hello this might be too late but if I understand you correctly, you want that other users can read, execute macros but not able to read the code behind it. Saving should be okay.

  1. The macro that you used should be password protected. First go to the editor, select the macro and view the properties/protection and set up a password
  2. Then after you are done, close the file. Right Click on the file/properties and check readonly. Users will then have access to the macro, not being able to see what code is behind it and can save it.