ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code to copy chart (https://www.excelbanter.com/excel-programming/271785-code-copy-chart.html)

Pedro[_4_]

Code to copy chart
 
Hi,
What code should I write in order to make an exact replace
of a chart I have but paste it as a picture in order for
me to change the series of the original chart whithout
changing the new
Many thanks
Pedro

Helen

Code to copy chart
 
The only way I can find to do it, is to paste it into a
Word document and copy it back. Very long-winded, but it
works:

Dim Word As Object

' Copy the chart
ActiveChart.ChartArea.Copy
' Open a hidden instance of Word
Set Word = CreateObject("Word.Application")
' Add a blank document and paste in the chart
Word.Documents.Add DocumentType:=wdNewBlankDocument
Word.Selection.Paste
' Select and copy the chart in Word
Word.Selection.WholeStory
Word.Selection.Copy
' Close Word
Word.activedocument.Close 0
Word.Application.Quit
Set Word = Nothing
' Paste it into Excel
ActiveSheet.Paste

Hope this helps
Helen



-----Original Message-----
Hi,
What code should I write in order to make an exact

replace
of a chart I have but paste it as a picture in order for
me to change the series of the original chart whithout
changing the new
Many thanks
Pedro
.



All times are GMT +1. The time now is 08:48 PM.

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