ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Chart into Word (https://www.excelbanter.com/excel-programming/324984-insert-chart-into-word.html)

Maynard

Insert Chart into Word
 
I'm not sure if this should be posted here or in the Word NG, but...

I'm trying to write a macro that will copy a selected chart (in Excel) into
an open Word Document (at the current location of the cursor). Unfotunately,
I'm only familiar with the Excel object model, not the Word object model. I
have the following code (but cant figure out what to put in XXXX). Of
course, I may be going about this completely the wrong way. Thanks for any
help...

Sub PortToWord()

Dim WrdDoc As Word.Document

Set WrdDoc = Word.ActiveDocument
ActiveChart.Copy
WrdDoc.XXXX.PasteSpecial DataType:=wdPasteEnhancedMetafile,
DisplayAsIcon:=False


End Sub


Fredrik Wahlgren

Insert Chart into Word
 

"Maynard" wrote in message
...
I'm not sure if this should be posted here or in the Word NG, but...

I'm trying to write a macro that will copy a selected chart (in Excel)

into
an open Word Document (at the current location of the cursor).

Unfotunately,
I'm only familiar with the Excel object model, not the Word object model.

I
have the following code (but cant figure out what to put in XXXX). Of
course, I may be going about this completely the wrong way. Thanks for

any
help...

Sub PortToWord()

Dim WrdDoc As Word.Document

Set WrdDoc = Word.ActiveDocument
ActiveChart.Copy
WrdDoc.XXXX.PasteSpecial DataType:=wdPasteEnhancedMetafile,
DisplayAsIcon:=False


End Sub


Wouldn't it be better to paste the chart as an image file?

/Fredrik



Maynard

Insert Chart into Word
 
Right now I'm just worried about pasting the chart into my document, not what
format is better.

"Fredrik Wahlgren" wrote:


"Maynard" wrote in message
...
I'm not sure if this should be posted here or in the Word NG, but...

I'm trying to write a macro that will copy a selected chart (in Excel)

into
an open Word Document (at the current location of the cursor).

Unfotunately,
I'm only familiar with the Excel object model, not the Word object model.

I
have the following code (but cant figure out what to put in XXXX). Of
course, I may be going about this completely the wrong way. Thanks for

any
help...

Sub PortToWord()

Dim WrdDoc As Word.Document

Set WrdDoc = Word.ActiveDocument
ActiveChart.Copy
WrdDoc.XXXX.PasteSpecial DataType:=wdPasteEnhancedMetafile,
DisplayAsIcon:=False


End Sub


Wouldn't it be better to paste the chart as an image file?

/Fredrik





All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com