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)
Dim <span id="parameterToolTip" class="tip" tabindex="0">FileName</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">ConfirmConversions</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">ReadOnly</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">AddToRecentFiles</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">PasswordDocument</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">PasswordTemplate</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Revert</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">WritePasswordDocument</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">WritePasswordTemplate</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Format</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Encoding</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">Visible</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">OpenAndRepair</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">DocumentDirection</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">NoEncodingDialog</span> As Object
Dim <span id="parameterToolTip" class="tip" tabindex="0">XMLTransform</span> As Object
Dim returnValue AsDim documents1 As Documents
returnValue = documents1.Open(<span id="parameterToolTip" class="tip" tabindex="0">FileName</span>, <span id="parameterToolTip" class="tip" tabindex="0">ConfirmConversions</span>, <span id="parameterToolTip" class="tip" tabindex="0">ReadOnly</span>, <span id="parameterToolTip" class="tip" tabindex="0">AddToRecentFiles</span>, <span id="parameterToolTip" class="tip" tabindex="0">PasswordDocument</span>, <span id="parameterToolTip" class="tip" tabindex="0">PasswordTemplate</span>, <span id="parameterToolTip" class="tip" tabindex="0">Revert</span>, <span id="parameterToolTip" class="tip" tabindex="0">WritePasswordDocument</span>, <span id="parameterToolTip" class="tip" tabindex="0">WritePasswordTemplate</span>, <span id="parameterToolTip" class="tip" tabindex="0">Format</span>, <span id="parameterToolTip" class="tip" tabindex="0">Encoding</span>, <span id="parameterToolTip" class="tip" tabindex="0">Visible</span>, <span id="parameterToolTip" class="tip" tabindex="0">OpenAndRepair</span>, <span id="parameterToolTip" class="tip" tabindex="0">DocumentDirection</span>, <span id="parameterToolTip" class="tip" tabindex="0">NoEncodingDialog</span>, <span id="parameterToolTip" class="tip" tabindex="0">XMLTransform</span>)
Function Open( _
<InAttribute()> ByRef FileName As Object, _
<InAttribute()> Optional ByRef ConfirmConversions As Object, _
<InAttribute()> Optional ByRef ReadOnly As Object, _
<InAttribute()> Optional ByRef AddToRecentFiles As Object, _
<InAttribute()> Optional ByRef PasswordDocument As Object, _
<InAttribute()> Optional ByRef PasswordTemplate As Object, _
<InAttribute()> Optional ByRef Revert As Object, _
<InAttribute()> Optional ByRef WritePasswordDocument As Object, _
<InAttribute()> Optional ByRef WritePasswordTemplate As Object, _
<InAttribute()> Optional ByRef Format As Object, _
<InAttribute()> Optional ByRef Encoding As Object, _
<InAttribute()> Optional ByRef Visible As Object, _
<InAttribute()> Optional ByRef OpenAndRepair As Object, _
<InAttribute()> Optional ByRef DocumentDirection As Object, _
<InAttribute()> Optional ByRef NoEncodingDialog As Object, _
<InAttribute()> Optional ByRef XMLTransform As Object _
) As Document
Document Open(
[In] ref object FileName,
[In, Optional] ref object ConfirmConversions,
[In, Optional] ref object ReadOnly,
[In, Optional] ref object AddToRecentFiles,
[In, Optional] ref object PasswordDocument,
[In, Optional] ref object PasswordTemplate,
[In, Optional] ref object Revert,
[In, Optional] ref object WritePasswordDocument,
[In, Optional] ref object WritePasswordTemplate,
[In, Optional] ref object Format,
[In, Optional] ref object Encoding,
[In, Optional] ref object Visible,
[In, Optional] ref object OpenAndRepair,
[In, Optional] ref object DocumentDirection,
[In, Optional] ref object NoEncodingDialog,
[In, Optional] ref object XMLTransform
);
public: Document^ Open(
&Object^ FileName,
&Object^ ConfirmConversions,
&Object^ ReadOnly,
&Object^ AddToRecentFiles,
&Object^ PasswordDocument,
&Object^ PasswordTemplate,
&Object^ Revert,
&Object^ WritePasswordDocument,
&Object^ WritePasswordTemplate,
&Object^ Format,
&Object^ Encoding,
&Object^ Visible,
&Object^ OpenAndRepair,
&Object^ DocumentDirection,
&Object^ NoEncodingDialog,
&Object^ XMLTransform
);
public Document Open(
/*in*/System.Object FileName,
/*in*/System.Object ConfirmConversions,
/*in*/System.Object ReadOnly,
/*in*/System.Object AddToRecentFiles,
/*in*/System.Object PasswordDocument,
/*in*/System.Object PasswordTemplate,
/*in*/System.Object Revert,
/*in*/System.Object WritePasswordDocument,
/*in*/System.Object WritePasswordTemplate,
/*in*/System.Object Format,
/*in*/System.Object Encoding,
/*in*/System.Object Visible,
/*in*/System.Object OpenAndRepair,
/*in*/System.Object DocumentDirection,
/*in*/System.Object NoEncodingDialog,
/*in*/System.Object XMLTransform
);
function Open(
FileName : Object,
ConfirmConversions : Object,
ReadOnly : Object,
AddToRecentFiles : Object,
PasswordDocument : Object,
PasswordTemplate : Object,
Revert : Object,
WritePasswordDocument : Object,
WritePasswordTemplate : Object,
Format : Object,
Encoding : Object,
Visible : Object,
OpenAndRepair : Object,
DocumentDirection : Object,
NoEncodingDialog : Object,
XMLTransform : Object
) : Document;
Parameters
- FileName
Required Object. The name of the document (paths are accepted).
- ConfirmConversions
Optional Object. True to display the Convert File dialog box if the file isn't in Microsoft Word format.
- ReadOnly
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
Optional Object. True to add the file name to the list of recently used files at the bottom of the File menu.
- PasswordDocument
Optional Object. The password for opening the document.
- PasswordTemplate
Optional Object. The password for opening the template.
- Revert
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
Optional Object. The password for saving changes to the document.
- WritePasswordTemplate
Optional Object. The password for saving changes to the template.
- Format
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
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 Microsoft.Office.Core.MsoEncoding constant. The default value is the system code page.
- Visible
Optional Object. True if the document is opened in a visible window. The default value is True.
- OpenAndRepair
Optional Object. True to repair the document to prevent document corruption.
- DocumentDirection
Optional Object. Can be a WdDocumentDirection constant.
- NoEncodingDialog
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
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.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Development Platforms
Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000Target Platforms