Duplicate Property

Applies To

Font object, LetterContent object, ParagraphFormat object, Range object, TextRetrievalMode object.

Description

Font object: Returns a Font object that represents the character formatting of the specified font. Read-only.

LetterContent object: Returns a LetterContent object that represents the contents of the specified letter created by the Letter Wizard. Read-only.

ParagraphFormat object: Returns a ParagraphFormat object that represents the paragraph formatting of the specified paragraph. Read-only.

Range object: Returns a Range object that represents all the properties of the specified range. Read-only.

TextRetrievalMode object: Returns a TextRetrievalMode object that represents options related to retrieving text from the specified Range object. Read-only.

Remarks

You can use the Duplicate property to pick up the settings of all the properties of a duplicated Font, LetterContent, or ParagraphFormat object. You can assign the object returned by the Duplicate property to another object of the same type to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original.

By duplicating a Range object, you can change the starting or ending character position of the duplicate range without changing the original range.

Example

This example duplicates the Range object assigned to the variable myRange. The example collapses the duplicate range to its end point, expands it by one character, and makes this character uppercase. The example then applies italic formatting to the original Range object (myRange).

Set myRange = Selection.Range
With myRange.Duplicate
    .Collapse Direction:=wdCollapseEnd
    .Expand Unit:=wdCharacter
    .Case = wdUpperCase
End With
myRange.Font.Italic = True
This example sets the variable MyDupFont to the character formatting of the selection, removes bold formatting from MyDupFont, and adds italic formatting to it instead. The example also creates a new document, inserts text into it, and then applies the formatting stored in MyDupFont to the text.

Set myDupFont = Selection.Font.Duplicate
With myDupFont
    .Bold = False
    .Italic = True
End With
Documents.Add
Selection.InsertAfter "This is some text."
Selection.Font = myDupFont
This example duplicates the paragraph formatting of the first paragraph in the active document and stores the formatting in the variable myDup, and then it changes the left indent for myDup to 1 inch. The example also creates a new document, inserts text into it, and then applies the paragraph formatting stored in myDup to the text.

ActiveDocument.Range(Start:=0, End:=0).InsertAfter "Paragraph Number 1"
Set myDup = ActiveDocument.Paragraphs(1).Format.Duplicate
myDup.LeftIndent = InchesToPoints(1)
Documents.Add
Selection.InsertAfter "This is a new paragraph."
Selection.Paragraphs.Format = myDup