Knowledge base KB0209

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.

  1. Open PowerPoint 2013 or later with a new empty file.
  2. In PowerPoint, go to Insert > think-cell > Tools Tools Menu icon. > Deactivate think-cell.
  3. Press Alt + F11 to open Microsoft Visual Basic for Applications.
  4. 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

  5. Add this code as a Module:

    Dim cPPTObject As New cEventClass
    
    Sub Initialize_Eventhandler()
        Set cPPTObject.PPTEvent = Application
        Debug.Print "**** EventHandler active ****"
    End Sub

  6. In the PowerPoint presentation window, press Alt + F8 to open the Macro window
  7. Run the Initialize_Eventhandler macro.
  8. 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:

  1. Deactivate think-cell in PowerPoint: Insert > think-cell > Tools Tools Menu icon. > Deactivate think-cell
  2. Open your corrupt file and repair it
  3. Reactivate think-cell in PowerPoint: Insert > think-cell > Activate

Share