다음을 통해 공유


Subdocuments.AddFromRange Method (Word)

Creates one or more subdocuments from the text in the specified range and returns a SubDocument object.

Syntax

expression .AddFromRange(Range)

expression Required. A variable that represents a Subdocuments collection.

Parameters

Name

Required/Optional

Data Type

Description

Range

Required

Range object

The range used to create one or more subdocuments.

Return Value

SubDocument

Remarks

The Range argument must begin with one of the built-in heading level styles (for example, Heading 1). Subdocuments are created at each paragraph formatted with the same heading format used at the beginning of the range. Subdocument files are saved when the master document is saved and are automatically named using text from the first line in the file.

Example

This example creates one or more subdocuments from the selection.

ActiveDocument.ActiveWindow.View.Type = wdMasterView 
ActiveDocument.SubDocuments.AddFromRange Range:=Selection.Range

See Also

Concepts

Subdocuments Object Members

Subdocuments Collection Object