I cannot repair my PowerPoint file with PowerPoint 2013 or later
Problem
PowerPoint fails to repair a corrupt PowerPoint file.
Explanation
Repairing PowerPoint files fails if slides are accessed programmatically before PowerPoint repairs them. However, think-cell and most likely also other add-ins must access slides when the file is opened, and there is no way for an add-in to know that a file is corrupt.
We filed a case with Microsoft, but so far Microsoft has not decided to fix it. If your company has a Microsoft Office Support contract and you want to contact Microsoft to ask for a fix, you may refer to Microsoft case number 115040112590053. The error can be reproduced without think-cell.
Reproduction without think-cell
The error can be reproduced without think-cell if any code accesses the corrupt slides before the repair is finished. In the following reproduction, the PresentationOpen event handler calls code accessing all slides when the file opens, i.e., before the repair.
- Open PowerPoint 2013 or later with a new empty file.
- In PowerPoint, go to Insert > think-cell > Tools > Deactivate think-cell.
- Press Alt + F11 to open Microsoft Visual Basic for Applications.
-
Add this code as a Class Module and name it
cEventClass
:Public WithEvents PPTEvent As Application Private Sub Class_Initialize() MsgBox "EventHandler is now active." End Sub Private Sub PPTEvent_PresentationOpen(ByVal pres As Presentation) On Error GoTo errHandle: Debug.Print "open file: " & pres.Name Dim i As Integer For i = 1 To pres.Slides.Count Debug.Print "Slide " & pres.Slides.Item(i).SlideNumber; " / " _ & pres.Slides.Count Next i Exit Sub errHandle: Debug.Print ("VBA Error: " & Err.Number & " " & Err.Description) & vbCr End Sub
-
Add this code as a Module:
Dim cPPTObject As New cEventClass Sub Initialize_Eventhandler() Set cPPTObject.PPTEvent = Application Debug.Print "**** EventHandler active ****" End Sub
- In the PowerPoint presentation window, press Alt + F8 to open the Macro window
- Run the Initialize_Eventhandler macro.
- Now open your corrupt PowerPoint file and try to repair it.
This problem does not occur with Microsoft Office 2010.
Solution
Until Microsoft fixes this bug, you can temporarily deactivate think-cell as a workaround:
- Deactivate think-cell in PowerPoint: Insert > think-cell > Tools > Deactivate think-cell
- Open your corrupt file and repair it
- Reactivate think-cell in PowerPoint: Insert > think-cell > Activate