I am trying to copy an excel Table and image from MS EXCEL to MS WORD using VBA. I was struggling to find out how will I reference the tables and images into the Word once they are sent from excel.
After a long research I came across a very simple answer for table :
Range("C1:D8").Copy Dim WDDoc As Word.Document Dim table1 As Word.Table Dim para As Paragraph Set para = WDDoc.Paragraphs.Add para.Range.PasteSpecial Link:=False, DataType:=wdPasteRTF, Placement:=wdInLine, DisplayAsIcon:=Falseset table1 = WDDoc.Tables(1) ‘ getting reference for the Pasted tables in word
table1.Shading.BackgroundPatternColor = wdColorBlueGray
What I have done:
I am able to copy an image from excel and simply pasting it on to word doc. para.
What I need?
after copying n picture i am not able to refer to that picture in word and hence not able to edit or resize the image once it is pasted.
Try this
This assumes that the picture is pasted “in line with text” (as you do) and is the last (furthest down) in-line picture in the document.