Paste Method

Microsoft Word Visual Basic

Paste Method

       

Inserts the contents of the Clipboard at the specified range or selection. If you don't want to replace the contents of the range or selection, use the Collapse method before using this method.

expression.Paste

expression   Required. An expression that returns a Range or Selection object.

Remarks

When this method is used with a range object, the range expands to include the contents of the Clipboard. When this method is used with a selection object, the selection doesn't expand to include the Clipboard contents; instead, the selection is positioned after the pasted Clipboard contents.

Example

This example copies and pastes the first table in the active document into a new document.

If ActiveDocument.Tables.Count >= 1 Then
    ActiveDocument.Tables(1).Range.Copy
    Documents.Add.Content.Paste
End If

This example copies the first paragraph in the document and pastes it at the insertion point.

ActiveDocument.Paragraphs(1).Range.Copy
Selection.Collapse Direction:=wdCollapseStart
Selection.Paste

This example copies the selection and pastes it at the end of the document.

If Selection.Type <> wdSelectionIP Then
    Selection.Copy
    Set Range2 = ActiveDocument.Content
    Range2.Collapse Direction:=wdCollapseEnd
    Range2.Paste
End If