How to Repair Excel Workbook using VBA?

The following code uses VBA to open and repair the workbook (the option available using Excel Open Dialog)

Sub OpenAndRepairWorkbook()

Dim oWB As Workbook

On Error GoTo Err_Open

Set oWB = Workbooks.Open(Filename:=”C:\ShasurData\ExcelVBA\VBE Tools 2007.xlam”, CorruptLoad:=XlCorruptLoad.xlRepairFile)

Exit Sub

Err_Open:

MsgBox Err.Number ; ” – ” ; Err.Description

Err.Clear

End Sub

Explore an Upcoming Excel VBA Batch nearby you to, learn effective ways of VB Coding and, automate your routine Excel Reports, processes and tasks with ease.

Happy Excelling
Team Excelgoodies
www.Excelgoodies.com

Leave a Reply

Your email address will not be published. Required fields are marked *