Forum Discussion
Open and Repair Workbook
- 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 SubWhen 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
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
- GeorgieAnneMar 27, 2025Iron Contributor
Thank You HansVogelaar
Yes these messages should be suppressed so that if the user goes to say get a cup of coffee, the code can continue and not waste all that time until the user comes back.
GiGi