Excel 2002 on Windows XP
I have added a rectangle to an embedded chart (the only thing in the chart is the rectangle):
I have a MouseOver event for the chart which returns the X and Y values (relative to the embedded chart) of the mouse pointer.
However, the X and Y values returned by my MouseOver event are strange:
1. The rectangle I created should have, and does have, its top left corner at (20,60), but the X and Y values returned by my MouseOver event do not give the correct values. This is the same for other corners of the rectangle.
2. I have determined the height of my chart:
If I place the mouse ponter at the bottom of my chart then the Y value returned by my MouseOver event is greater than the Height of the chart. This is the same for the width of the chart.
I would like my MouseOver event to return the correct X and Y values, or a way to transform the MouseOver X and Y values to the correct values. Does anyone know how to do this?
Thanks
I have added a rectangle to an embedded chart (the only thing in the chart is the rectangle):
Code:
Application.Worksheets(1).ChartObjects.Add (Left:=20, Width:=375, Top:=40, Height:=225)
With Application.Worksheets(1).ChartObjects(1).Chart.Shapes.AddShape(Type:=msoShapeRectangle, Left:=20, Top:=60, Width:=40, Height:=100)
.Fill.Visible = msoFalse
End With
However, the X and Y values returned by my MouseOver event are strange:
1. The rectangle I created should have, and does have, its top left corner at (20,60), but the X and Y values returned by my MouseOver event do not give the correct values. This is the same for other corners of the rectangle.
2. I have determined the height of my chart:
Code:
Application.Worksheets(1).ChartObjects(1).Height
If I place the mouse ponter at the bottom of my chart then the Y value returned by my MouseOver event is greater than the Height of the chart. This is the same for the width of the chart.
I would like my MouseOver event to return the correct X and Y values, or a way to transform the MouseOver X and Y values to the correct values. Does anyone know how to do this?
Thanks