Range.PasteExcelTable method (Word)
Pastes and formats a Microsoft Excel table.
Syntax
expression. PasteExcelTable
( _LinkedToExcel_
, _WordFormatting_
, _RTF_
)
expression Required. A variable that represents a Range object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
LinkedToExcel | Required | Boolean | True links the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Word. |
WordFormatting | Required | Boolean | True formats the table using the formatting in the Word document. False formats the table according to the original Excel file. |
RTF | Required | Boolean | True pastes the Excel table using Rich Text Format (RTF). False pastes the Excel table as HTML. |
Example
This example pastes an Excel table into the active document. The parameters specify that the pasted table is linked to the Excel file, retains the original Excel formatting, and is pasted as RTF. This example assumes that the Clipboard contains an Excel table.
Sub PasteExcelFormatted()
Selection.PasteExcelTable _
LinkedToExcel:=True, _
WordFormatting:=False, _
RTF:=True
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.