Share via


How to: Open Existing Documents

The Open method opens the existing Microsoft Office Word document specified by a fully qualified path and file name. This method returns a Microsoft.Office.Interop.Word.Document that represents the opened document.

Applies to: The information in this topic applies to document-level projects and application-level projects for Word 2007 and Word 2010. For more information, see Features Available by Office Application and Project Type.

To open a document

  • Call the Open method of the Documents collection and supply a path to the document.

    Me.Application.Documents.Open("C:\Test\NewDocument.doc")
    
    this.Application.Documents.Open(@"C:\Test\NewDocument.doc");
    

To open a document as read-only

  • Call the Open method, supply a path to the document, and set the ReadOnly argument to True in the method call.

    Me.Application.Documents.Open(FileName:="C:\Test\NewDocument.doc", ReadOnly:=True)
    
    this.Application.Documents.Open(@"C:\Test\NewDocument.doc", ReadOnly:true);
    

Compiling the Code

This code example requires the following:

  • A document named NewDocument.doc must exist in a directory named Test on drive C.

See Also

Tasks

How to: Create New Documents

How to: Close Documents

Concepts

Optional Parameters in Office Solutions