A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Thanks for the update, that is a known issue, unfortunately there is no solution.
Andreas.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I am getting incorrect readings from the above method when I have an extended desktop. I have screen one on my laptop and screen 2 above it on a monitor. when I move my cursor over the graph in the monitor I get totally incorrect events, but when I moved the active window to my laptop screen it seems OK.
The chart I'm working on is a combo chart with lines and areas (not stacked).
Is there a way to correct this?
Thanks!
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Thanks for the update, that is a known issue, unfortunately there is no solution.
Andreas.
Just an update on this: if I have two windows open, regardless of which monitor they are on, the problem described above occurs if the windows have different zoom settings (within excel).
If I have the same sheet open on two different windows and I set the zoom to the same, then the GetChartElement method works properly on both.
If I have different zoom settings, then it works ok in one, but not the other.
It seems like the transformation between pixels and points is affected by the window zoom setting.
Just an idea:
What happens when you change the monitor settings in the Control Panel?
Setup the monitors side by side, rather than one above the other.
Ask you question also in the developers forum:
social.msdn.microsoft.com/Forums/en-us/home?forum=exceldev
Andreas.
Yep. That's the method I used, except I used a class module.
My code works fine but occasionally it gets into a mode where the Elements returned are very different from what's actually under the cursor.
First time it happened it came good when I moved the window from the monitor to the laptop display.
Today it happened again but it persisted when I tried the above work-around.
This time I checked more closely and I verified that the elements detected were about an inch below the cursor.
For example it was reading legend elements when the cursor was well above the legend.
I'm wondering if others had the same problem and if so, how to protect against it.
I can't answer your question, because I did not have Excel 2013... but maybe I can help anyway.
In Excel 2010 it works with multiple monitors. Make a new file, copy the code below into the code module of a sheet, exit the VBA editor, switch to an other sheet an back, then hover the mouse over the chart.
Does it work in Excel 2013? If so, show us your code.
Andreas.
Option Explicit
Dim WithEvents C As Chart
Private Sub Worksheet_Activate()
If Me.ChartObjects.Count = 0 Then
With WorksheetFunction
Range("A1:A4") = .Transpose(Array("Line", 1, 2, 3))
Range("B1:B4") = .Transpose(Array("Area", 4, 5, 6))
End With
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Range("A1:B4")
ActiveChart.SeriesCollection(2).ChartType = xlArea
End If
Set C = Me.ChartObjects(1).Chart
End Sub
Private Sub C_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, _
ByVal Y As Long)
Dim ElementIDs
Dim ElementID As Long, Arg1 As Long, Arg2 As Long
C.GetChartElement X, Y, ElementID, Arg1, Arg2
ElementIDs = Array("xlDataLabel", "unknown", "xlChartArea", "xlSeries", _
"xlChartTitle", "xlWalls", "xlCorners", "xlDataTable", "xlTrendline", "xlErrorBars", _
"xlXErrorBars", "xlYErrorBars", "xlLegendEntry", "xlLegendKey", "xlShape", _
"xlMajorGridlines", "xlMinorGridlines", "xlAxisTitle", "xlUpBars", "xlPlotArea", _
"xlDownBars", "xlAxis", "xlSeriesLines", "xlFloor", "xlLegend", "xlHiLoLines", _
"xlDropLines", "xlRadarAxisLabels", "xlNothing", "xlLeaderLines", "xlDisplayUnitLabel", _
"xlPivotChartFieldButton", "xlPivotChartDropZone")
If ElementID <= UBound(ElementIDs) Then
Range("D1") = ElementIDs(ElementID)
Else
Range("D1") = "Unknown " & ElementID
End If
Range("D2") = Arg1
Range("D3") = Arg2
DoEvents
End Sub