I have a word doc called myGraph.doc and a bookmark within the document entitled myMark. What I would like to do is have code within an Excel Doc place a graph at the designated bookmark ("myMark").
I have code written in Excel that opens the above Word document (myGraph.doc) and places a picture of the graph in it. The problem is that it places it in the Title area of the document and not at the designated bookmark.
When I attempt to add code to place the picture chart at the designated spot, I get an 4198 run time error - Application defined or object defined error. The following is the code producing the error:
Code:
Dim bMark As Bookmark
If Not IsNull(ActiveChart) Then
Set bMark = WDApp.ActiveDocument.Bookmarks("myMark")
' Paste chart at cursor position
WDApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
Placement:=bMark, DisplayAsIcon:=False
End If
I am pretty sure it bombs at the Placement:=bMark spot. Any ideas as to what I am doing wrong? I am a .Net developer and am pretty green when it comes to developing in VBA.
Thanks (in advance) for your help!