Subdocuments.AddFromFile Method

Adds the specified subdocument to the master document at the start of the selection and returns a Subdocument object.

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

Syntax

'Declaration
Function AddFromFile ( _
    ByRef Name As Object, _
    ByRef ConfirmConversions As Object, _
    ByRef ReadOnly As Object, _
    ByRef PasswordDocument As Object, _
    ByRef PasswordTemplate As Object, _
    ByRef Revert As Object, _
    ByRef WritePasswordDocument As Object, _
    ByRef WritePasswordTemplate As Object _
) As Subdocument
'Usage
Dim instance As Subdocuments
Dim Name As Object
Dim ConfirmConversions As Object
Dim ReadOnly As Object
Dim PasswordDocument As Object
Dim PasswordTemplate As Object
Dim Revert As Object
Dim WritePasswordDocument As Object
Dim WritePasswordTemplate As Object
Dim returnValue As Subdocument

returnValue = instance.AddFromFile(Name, _
    ConfirmConversions, ReadOnly, PasswordDocument, _
    PasswordTemplate, Revert, WritePasswordDocument, _
    WritePasswordTemplate)
Subdocument AddFromFile(
    ref Object Name,
    ref Object ConfirmConversions,
    ref Object ReadOnly,
    ref Object PasswordDocument,
    ref Object PasswordTemplate,
    ref Object Revert,
    ref Object WritePasswordDocument,
    ref Object WritePasswordTemplate
)

Parameters

  • Name
    Type: System.Object%
    Required Object. The file name of the subdocument to be inserted into the master document.
  • ConfirmConversions
    Type: System.Object%
    Optional Object. True to confirm file conversion in the Convert File dialog box if the file isn't in Microsoft Word format.
  • ReadOnly
    Type: System.Object%
    Optional Object. True to insert the subdocument as a read-only document.
  • PasswordDocument
    Type: System.Object%
    Optional Object. The password required to open the subdocument if it's password protected.
  • PasswordTemplate
    Type: System.Object%
    Optional Object. The password required to open the template attached to the subdocument if the template is password protected.
  • Revert
    Type: System.Object%
    Optional Object. Controls what happens if Name is the file name of an open document. True to insert the saved version of the subdocument. False to insert the open version of the subdocument, which may contain unsaved changes.
  • WritePasswordDocument
    Type: System.Object%
    Optional Object. The password required to save changes to the document file if it's write protected.
  • WritePasswordTemplate
    Type: System.Object%
    Optional Object. The password required to save changes to the template attached to the subdocument if the template is write protected.

Return Value

Type: Microsoft.Office.Interop.Word.Subdocument

Remarks

Note If the active view isn't either outline view or master document view, an error occurs.

See Also

Reference

Subdocuments Interface

Subdocuments Members

Microsoft.Office.Interop.Word Namespace