Pasting


Range.Paste

This is the same as Selection.Paste
Pastes the contents of the clipboard at the current position. This replaces the current selection
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.
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.


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:=wdCollapseDirection.wdCollapseStart
Selection.Paste

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


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

Selection.PasteAndFormat

Selection.PasteAndFormat(wdRecoveryType.wdPasteDefault)
This method pastes the selected table cells and formats them as specified


Pastes the table cells and formats them as specified

Selection.PasteAndFormat(wdRecoveryType. 

It doesn't matter what the Zoom percentage is, the image is automatically resized to fit the width of the page
This line will paste an Excel chart as a picture

Selection.PasteAndFormat(wdRecovery.wdChartPicture) 

Selection.PasteExcelTable



Selection.PasteFormat



Range.PasteSpecial

This is the same as Selection.PasteSpecial
Inserts the contents of the Clipboard allowing you to control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Excel worksheet).
Note If you don't want to replace the contents of the specified range or selection, use the Collapse method before you use this method. When you use this method, the range or selection doesn't expand to include the contents of the Clipboard.


Selection.Range.PasteSpecial(IconIndex:= , _ 
                             Link:=False, _
                             Placement:=wdOLEPlacement.wdInLine , _
                             DisplayAsIcon:=False, _
                             DataType:=wdPasteDataType.wdPasteText , _
                             IconFileName:= , _
                             IconLabel )

IconIndex - (Variant) If DisplayAsIcon is True, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. Icons appear in the Change Icon dialog box (Insert menu, Object command, Create New tab): 0 (zero) corresponds to the first icon, 1 corresponds to the second icon, and so on. If this argument is omitted, the first (default) icon is used.
Link - (Variant) True to create a link to the source file of the Clipboard contents. The default value is False.
DisplayAsIcon - (Variant) True to display the link as an icon. The default value is False.
IconFileName - (Variant) If DisplayAsIcon is True, this argument is the path and file name for the file in which the icon to be displayed is stored.
IconLabel - (Variant) If DisplayAsIcon is True, this argument is the text that appears below the icon.



This example inserts the Clipboard contents at the insertion point as unformatted text.

Selection.Collapse Direction:=wdCollapseDirection.wdCollapseStart 
Selection.Range.PasteSpecial DataType:=wdPasteDataType.wdPasteText


This example copies the selected text and pastes it into a new document as a hyperlink. The source document must first be saved for this example to work.

If Selection.Type = wdSelectionType.wdSelectionNormal Then 
    Selection.Copy
    Documents.Add.Content.PasteSpecial Link:=True, _
        DataType:=wdPasteDataType.wdPasteHyperlink
End If


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext