Applies to
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
Project type
Document-level projects
Application-level projects
Microsoft Office version
Word 2003
Word 2007
For more information, see Features Available by Application and Project Type.
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.
Call the Open method of the Documents collection and supply a path to the document.
Me.Application.Documents.Open("C:\Test\NewDocument.doc")
object fileName = @"C:\Test\NewDocument.doc"; this.Application.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
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)
object readOnly = true; object fileName = @"C:\Test\NewDocument.doc"; this.Application.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
This code example requires the following:
A document named NewDocument.doc must exist in a directory named Test on drive C.