Copy Method

Microsoft Word Visual Basic

Show All

Copy Method

       

Copy method as it applies to the Bookmark object.

Sets the bookmark specified by the Name argument to the location marked by another bookmark, and returns a Bookmark object. Bookmark object.

expression.Copy(Name)

expression   Required. An expression that returns one of the above objects.

Name  Required String. The name of the new bookmark.

 

Copy method as it applies to the Field, FormField, Frame, MailMergeField, PageNumber, Range, and Selection objects.

Copies the specified object to the Clipboard.

expression.Copy

expression   Required. An expression that returns one of the above objects.

 

Example

As it applies to the Selection object.

This example copies the contents of the selection into a new document.

If Selection.Type = wdSelectionNormal Then
    Selection.Copy
    Documents.Add.Content.Paste
End If

As it appllies to the BookMark object.

This example sets the Book2 bookmark to the location marked by the Book1 bookmark.

ActiveDocument.Bookmarks("Book1").Copy Name:="Book2"

As it applies to the Range object.

This example sets the Selection bookmark to the \Sel predefined bookmark in the active document.

ActiveDocument.Bookmarks("\Sel").Copy Name:="Selection"

This example copies the first paragraph in the active document and pastes it at the end of the document.

ActiveDocument.Paragraphs(1).Range.Copy
Set myRange = ActiveDocument.Range _
    (Start:=ActiveDocument.Content.End - 1, _
    End:=ActiveDocument.Content.End - 1)
myRange.Paste

This example copies the comments in the active document to the Clipboard.

If ActiveDocument.Comments.Count >= 1 Then
    ActiveDocument.StoryRanges(wdCommentsStory).Copy
End If