Pastespecial from Excel 2010 to Word 2010

joyrock37

New Member
Joined
Oct 14, 2011
Messages
26
Thank you for reading:pray: ;)
I want to copy a range from Excel containing formatted text in cells to Word.
This is what I have so far:
Code:
Sub ExcelToWord()

Dim wdApp As Object
Dim wdDoc As Object
Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.Documents.Add
wdApp.Visible = True

'Setup page
    With wdDoc.PageSetup
    .LeftMargin = Application.InchesToPoints(0.7)
    .RightMargin = Application.InchesToPoints(0.25)
    .TopMargin = Application.InchesToPoints(0.5)
    .BottomMargin = Application.InchesToPoints(0.5)
End With

    'Page 1
    ThisWorkbook.Sheets(1).Range("A1:S39").Copy
    wdApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteText, _
        Placement:=wdInLine, DisplayAsIcon:=False
    wdApp.Selection.Characters.Last.Select
 
wdDoc.Close
wdApp.Quit
Set wdApp = Nothing

End Sub

Here is the problem:
The parameter wdPasteText creates an embedded Excel Object.
So I tried other parameters, wdpasteRTF, wdpasteHTML, wdpasteEnhancedMetafile all with the same result!
What am I doing wrong?
Thanks for helping! (y)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
If you are late binding you can't use Word constants like wdPasteText. Use the value of the constants instead (2). It happens that wdInLine is OK because its value is zero.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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