How to: Programmatically Open Existing Documents
The M:Microsoft.Office.Interop.Word.Documents.Open(System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@) 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 VSTO add-in projects for Word. For more information, see Features Available by Office Application and Project Type.
To open a document
Call the M:Microsoft.Office.Interop.Word.Documents.Open(System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@) method of the T:Microsoft.Office.Interop.Word.Documents collection and supply a path to the document.
To open a document as read-only
Call the M:Microsoft.Office.Interop.Word.Documents.Open(System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@,System.Object@) method, supply a path to the document, and set the ReadOnly argument to True in the method call.
This code example requires the following:
- A document named NewDocument.doc must exist in a directory named Test on drive C.
How to: Programmatically Create New Documents
How to: Programmatically Close Documents
Optional Parameters in Office Solutions