Issues copying excel charts to word documents - using Excel VBA

F

Frankie

Hi,

I am trying to copy a chart from excel into a word document, at a
position specified by a bookmark. I also want the float over text to be
deactivated. My rather poor attempt at that was:

Sub FlushGraphs()

Dim WordObj As Word.Application, WordDoc As Word.Template

Set WordObj = CreateObject("Word.Application")

Sourcedir = ThisWorkbook.Path
FileName = Sourcedir & "\myworddocument.doc"
WordObj.Documents.Open (FileName)
WordObj.Visible = True

With Excel.Application
.ActiveSheet.ChartObjects("Chart 2").Activate
.ActiveChart.ChartArea.Select
.ActiveChart.ChartArea.Copy
End With



With WordObj

rRange = .ActiveDocument.Bookmarks(1).Range
rRange.PasteSpecial Link:=False,
DataType:=wdPasteEnhancedMetafile, _
Placement:=wdInLine, DisplayAsIcon:=False

.ActiveDocument.Bookmarks(2).Range.Text = "HELLO" ' to satisfy
myself the bookmarks work
End With


' Set WordDoc = Nothing
' Set WordObj = Nothing
' WordObj.Documents.Save
' WordObj.Documents.Close
' WordObj.Quit

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top