Sunday, February 22, 2009

Programmatically Open and Repair workbook using VBA

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


MsgBox Err.Number & " - " & Err.Description


End Sub

1 comment:

  1. tHANK YOU !!! I've been looking for this code long time ago in spanish, you english people so good :P


Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO Google Group