ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comparing charts after cut and paste (https://www.excelbanter.com/excel-programming/331314-comparing-charts-after-cut-paste.html)

Martin

Comparing charts after cut and paste
 
Hi,

I am currently wrting a part of an add-in that dynamically charts data
within a worksheet which changes depending on a users actions. Everything
works fine until the chart object is cut and pasted. When this happens my
object loses the chart object and there seems to be no way of identifying the
newly pasted chart as being the same as the one that was cut. The chart name
is changed (for instance from "chart 1" to "chart 2"), so that can't be used
as a comparison, and i can't find any other properties which would be
suitable.

Anyone got any suggestions?

Many Thanks
Martin

K Dales[_2_]

Comparing charts after cut and paste
 
Can you show the code where you do the cut and paste (and the object variable
Dim statements would be helpful also)

"Martin" wrote:

Hi,

I am currently wrting a part of an add-in that dynamically charts data
within a worksheet which changes depending on a users actions. Everything
works fine until the chart object is cut and pasted. When this happens my
object loses the chart object and there seems to be no way of identifying the
newly pasted chart as being the same as the one that was cut. The chart name
is changed (for instance from "chart 1" to "chart 2"), so that can't be used
as a comparison, and i can't find any other properties which would be
suitable.

Anyone got any suggestions?

Many Thanks
Martin


Martin

Comparing charts after cut and paste
 
Sorry i probably wasn't very clear with my initial post - i mean if the user
cuts and pastes as per usual, for instance cuts a chart and pastes it to
another sheet in the workbook. I would then want to be able to search for
that chart - but at the moment i cannot see a way of identifying it as the
chart that my original object held.

Here is how I set up my object:
Dim oChartObj As ChartObject
Dim oGridChart As XL3GridChartLib.GridChart

Set oGridChart = New XL3GridChartLib.GridChart
Set oGridChart.ChartObject = oGridChart.Sheet.ChartObjects.Add(200, 3, 280,
175)

the gridchart object then does a bunch of stuff to get all the data it needs

"K Dales" wrote:

Can you show the code where you do the cut and paste (and the object variable
Dim statements would be helpful also)




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

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