Importing Excel Range data to Word doc

harshi7

New Member
Joined
Jun 11, 2019
Messages
9
Hello All,

I need to import an excel 'Range' which contains texts and images into Word document. I have used the below code.
Problem is images are misplaced after importing into word document and few images are above the text content.

how do i maintain the structured format even after importing? Please help

Code:

Sub SaveDoc()
Dim rangetocopy As Range
Dim WordApp As Word.Application
Dim myDoc As Word.Document
Dim WordTable As Word.Table




Set rangetocopy = Range("A1:C203")
Set WordApp = New Word.Application
WordApp.Visible = True
Set myDoc = WordApp.Documents.Add
rangetocopy.Copy
myDoc.Words(1).PasteExcelTable False, False, False


End Sub
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,439
You might try varying your PasteExcelTable arguments. Otherwise, you might try:
myDoc.Range.PasteSpecial DataType:=wdPasteOLEObject
to insert the actual worksheet, or:
myDoc.Range.PasteAndFormat wdChartPicture
to insert the content as an image.
 

harshi7

New Member
Joined
Jun 11, 2019
Messages
9
Hello Paul,

thanks for your reply. I tried changing the PasteExcelTable arguments, I am getting the contents in word as tabular form (I will not be able to edit the word contents properly). But I need the word contents to be in normal format where I can edit the word document easily.
Please suggest
 

Macropod

Retired Moderator
Joined
Aug 27, 2007
Messages
3,439
Provided the first argument is kept 'False' , either of the second two of the .PasteExcelTable arguments will allow you to edit the content in Word - as will .PasteSpecial DataType:=wdPasteOLEObject.
 

harshi7

New Member
Joined
Jun 11, 2019
Messages
9
If i use .PasteExcelTable with second arguments as False True False -Entire excel range content will be saved in word as table format and same result with paste special. If I use False False True - Each excel cell content is saved as tabular form. I cannot give backspace or edit the contents properly
 

Watch MrExcel Video

Forum statistics

Threads
1,099,000
Messages
5,465,937
Members
406,453
Latest member
MarkB5432

This Week's Hot Topics

Top