View Full Version : Pasting an excel chart that is linked to excel in a text box in MS Word

10-28-2009, 05:04 AM
I am having problem pasting in a text box in Word 2007, a copied excel chart that is to be still linked to the source excel chart . Surprisingly I was able to paste the excel chart when I copied it as a picture in excel.
Basically the way I programmed it is that, I add the textbox using a VBA like this,
ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, x, y, width, CentimetersToPoints(height))

After adding the text box, I then select the text box and try to paste the chart using a code like this,
Selection.Range.PasteSpecial link:=True, DataType:=wdPasteMetafilePicture, Placement:=wdInLine

The drawing of textbox and pasting of chart code above are executed via custom ribbon buttons I added to Word 2007.

I have tried to paste using the following as well.
Selection.Range.PasteAndFormat (wdChartLinked)
Selection.Range.PasteSpecial link:=True, DataType:=wdPasteOLEObject, Placement:=wdInLine
None of them worked. They all gave me error message, "This command is not available."

Thanks for your help.