Forum Discussion

GeorgieAnne's avatar
GeorgieAnne
Iron Contributor
Mar 26, 2025
Solved

Open and Repair Workbook

Hello Excellers, Is there any harm in using Open and Repair on a workbook that is not malfunctioning, just to makes sure that there are no issued?   Any VBA example on how to invoke the Open and R...
  • HansVogelaar's avatar
    Mar 26, 2025

    No, it won't hurt, but it will always report that errors were detected and repaired, even if there were none.

    You can specify that the workbook should be repaired when you open it:

    Sub Test()
        Dim wbk As Workbook
        Set wbk = Workbooks.Open(Filename:="Book1.xlsx", CorruptLoad:=xlRepairFile)
    End Sub

    When you run this, the same message will pop up that you see when you select Open and Repair manually.

    If you want to suppress this:

    Sub Test()
        Dim wbk As Workbook
        Application.DisplayAlerts = False
        Set wbk = Workbooks.Open(Filename:="Book1.xlsx", CorruptLoad:=xlRepairFile)
        Application.DisplayAlerts = True
    End Sub