vba paste range to word keeping column width

Roger G

New Member
Joined
Dec 22, 2016
Messages
2
Hello,

I have a macro that copies a range of cells (I can’t create it as a table, because some cells are merged) and pastes it to a Word. I can’t paste it as image neither because it needs to be able to be modified later in Word.

I want it to keep the columns width, it works fine except when a cell contains a text larger than the width of the cell (with distributed alignment i excel), as when it is pasted to word, the column modifies its width to keep the text in just one line.


I have tried different options, like objWord.Selection.PasteSpecial xlPasteColumnWidth or objWord.Selection.PasteAndFormat (wdFormatOriginalFormatting), but none works as i want.

I have tried manually and what i need is to to paste like “link & keep source formatting”

Any ideas?

Thanks

Apologies if there are some mistakes, English is not my mother tongue
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
If you need what is pasted to faithfully represent the Excel workbook, as per paste link (but without the link), use:
.PasteSpecial Link:=False, DataType:=wdPasteOLEObject, Placement:=wdInLine, DisplayAsIcon:=False
 
Upvote 0
Another option would be to use:
.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=True
This creates a table in Word that has the same formatting as the Excel range, including text wrapping, etc.
 
Upvote 0
Thank you!
The fist one dind't work, it pasted the range as a image, but the .PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=True worked fine :)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top