Documents.Open method

Opens the specified document and adds it to the Documents collection.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Document Open(
	ref Object FileName,
	ref Object ConfirmConversions,
	ref Object ReadOnly,
	ref Object AddToRecentFiles,
	ref Object PasswordDocument,
	ref Object PasswordTemplate,
	ref Object Revert,
	ref Object WritePasswordDocument,
	ref Object WritePasswordTemplate,
	ref Object Format,
	ref Object Encoding,
	ref Object Visible,
	ref Object OpenAndRepair,
	ref Object DocumentDirection,
	ref Object NoEncodingDialog,
	ref Object XMLTransform
)

Parameters

FileName
Type: System.Object

Required Object. The name of the document (paths are accepted).

ConfirmConversions
Type: System.Object

Optional Object. True to display the Convert File dialog box if the file isn't in Microsoft Word format.

ReadOnly
Type: System.Object

Optional Object. True to open the document as read-only.

Note This argument doesn't override the read-only recommended setting on a saved document. For example, if a document has been saved with read-only recommended turned on, setting the ReadOnly argument to False will not cause the file to be opened as read/write.

AddToRecentFiles
Type: System.Object

Optional Object. True to add the file name to the list of recently used files at the bottom of the File menu.

PasswordDocument
Type: System.Object

Optional Object. The password for opening the document.

PasswordTemplate
Type: System.Object

Optional Object. The password for opening the template.

Revert
Type: System.Object

Optional Object. Controls what happens if FileName is the name of an open document. True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.

WritePasswordDocument
Type: System.Object

Optional Object. The password for saving changes to the document.

WritePasswordTemplate
Type: System.Object

Optional Object. The password for saving changes to the template.

Format
Type: System.Object

Optional Object. The file converter to be used to open the document. Can be a WdOpenFormat constant.

To specify an external file format, apply the OpenFormat property to a FileConverter object to determine the value to use with this argument.

Encoding
Type: System.Object

Optional Object. The document encoding (code page or character set) to be used by Microsoft Word when you view the saved document. Can be any valid MsoEncoding constant. The default value is the system code page.

Visible
Type: System.Object

Optional Object. True if the document is opened in a visible window. The default value is True.

OpenAndRepair
Type: System.Object

Optional Object. True to repair the document to prevent document corruption.

DocumentDirection
Type: System.Object

Optional Object. Can be a WdDocumentDirection constant.

NoEncodingDialog
Type: System.Object

Optional Object. True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default value is False.

XMLTransform
Type: System.Object

Optional Object. Specifies a transform to use.

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Show:
© 2015 Microsoft