How to open documents by using the Open and Repair feature in Word

Article translations Article translations
Article ID: 893672 - View products that this article applies to.
Expand all | Collapse all

On This Page

INTRODUCTION

This article describes how to open documents by using the Open and Repair feature in Microsoft Office Word 2002 and later versions.

MORE INFORMATION

Microsoft Word automatically uses the Open and Repair feature if Word detects a problem with a document when you open it. However, you can force Word to use the Open and Repair feature when you open any document. This may be especially useful when you intend to save the document in a different file format. If you save a damaged document in a different file format, you may not be able to open the saved document. For more information about how to troubleshoot damaged Word documents, click the following article number to view the article in the Microsoft Knowledge Base:
826864 How to troubleshoot damaged Word documents (for Word 2002 and 2003)
918429 How to troubleshoot damaged documents in Word 2007 and in Word 2010


To open a document by using the Open and Repair feature in Word, use one of the following methods.

Method 1: To open a specific document

To open a specific document by using the Open and Repair feature in Word, follow these steps:
  1. Start Word.
  2. On the File menu, click Open.

    Note In Word 2007 or Word 2010, click the Microsoft Office Button, and then click Open.
  3. In the Open dialog box, click to select the file that you want to open.
  4. Click the down arrow on the Open button, and then click Open and Repair.

Method 2: To open all documents

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To open all documents by using the Open and Repair feature in Word, replace the built-in FileOpen macro in Word with a Microsoft Visual Basic for Applications (VBA) macro. To do this, follow these steps:
  1. Start Word, and then open a new blank document.
  2. In Word 2007, click Macros on the Developer tab. In Word 2003, point to Macro on the Tools menu, and then click Macros.
  3. Click the down arrow in the Macros in box, and then click Word commands.
  4. In the Macro name list, click FileOpen.
  5. Click the down arrow in the Macros in box, and then click Normal.dot (global template).

    Note In Word 2007 and Word 2010, click Normal.dotm (global template).
  6. Click Create.
  7. The built-in FileOpen macro appears as in the following example:
    Sub FileOpen()
    '
    ' FileOpen Macro
    ' Opens an existing document or template
    '
        Dialogs(wdDialogFileOpen).Show
    
    End Sub
    
  8. Replace the built-in FileOpen macro with the following macro example:
    Option Explicit
    
    ' WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS EXAMPLE IS
    ' AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of
    ' any kind, either expressed or implied, including but not limited to the implied 
    ' warranties of merchantability and/or fitness for a particular purpose.
    
    Sub FileOpen()
    '
    ' FileOpen Macro
    ' Opens an existing document or template
    '
    Dim sFileName As String
    
    ' Display the File Open dialog and capture the filename selected and pass it to a
    ' variable
    With Application.Dialogs(wdDialogFileOpen)
        .Display
        sFileName = .Name
    End With
    
    ' Test to verify the filename has a value
    ' If no file is chosen or if the Open dialog is dismissed, 
    ' the following code is skipped
    If sFileName <> "" Then
        ' Use the filename as a variable to be opened using Open and Repair feature
        Documents.Open FileName:=sFileName, OpenAndRepair:=True
    End If
    
    End Sub
    
  9. On the File menu, click Close and Return to Microsoft Word.
  10. On the File menu, press SHIFT, and then click Save All.
Notes
  • The new FileOpen macro will run only if you open a document by using any one of the following methods:
    • You click Open on the File menu.
    • You click Open on the Standard toolbar.
  • The new FileOpen macro will not run if you open a document by using any one of the following methods:
    • You open the document in Windows Explorer.
    • You open the document from the most recently used (MRU) file list.

Properties

Article ID: 893672 - Last Review: August 18, 2010 - Revision: 6.0
APPLIES TO
  • Microsoft Office Word 2007
  • Microsoft Word 2002
  • Microsoft Word 2010
Keywords: 
kbopenfile kbprogramming kbautomation kbvba kbhowto KB893672

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com