I'm trying to copy a range from Excel and paste it as an image into Word at the body of each page. I am using a Picture Content Control to achieve this. There seems to be limited documentation to use this control. Please help.
Dim objWord, objDoc As Object, rng As Range, objCC As ContentControl
Set rng = ThisWorkbook.Worksheets(strSheetName).Names(strSheetName & "_Range").RefersToRange
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Open(ThisWorkbook.Path & "\Template.docx")
'Set objCC = objDoc.SelectContentControlsByTag("idControl1")(1)
objDoc.PageSetup.Orientation = 1
objWord.Selection.Paste
objWord.Selection.TypeParagraph
'objDoc.Save
Alternatively, I tried using bookmarks and they work. Got the suggestion from http://www.ozgrid.com/forum/showthread.php?t=160430 . I added this line to my code objWord.Selection.Goto What:=wdGoToBookmark, Name:="bkm1".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.