0

I try to copy a Range of Cells from an Excel Worksheet into a Word Document on a specific Bookmark. Additional a resize would be great but I don't come so far. If it's necessary to mention I don't want to have a Visible Word or Excel (because I saw it on some Code and don't know if it's mandatory). Here the Code:

Set ObjWkBk = ObjXl.Workbooks.Open("C:\test.xlsx")

Set ObjWd = CreateObject("Word.Application")
Set ObjDoc = ObjWd.Documents.Add("C:\test.docx")

Set xlRange =  ObjWkBk.Worksheets("Sheet1").Range("A1:D4").Select

Set wdRange = ObjDoc.Bookmarks("Ending").Range

xlRange.CopyPicture
wdRange.Paste

ObjDoc.SaveAs ("C:\test1.docx")

ObjDoc.Close: ObjWd.Quit: ObjWkBk.Close: ObjXl.Quit
Set ObjDoc = Nothing: Set ObjWd = Nothing: Set ObjWkBk = Nothing: Set ObjXl = Nothing

The Error is the following: Error: Expected Statement Code: 800A0400

Gia86
  • 5
  • 3

0 Answers0