ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   GET.CHART.ITEM returning strange results (https://www.excelbanter.com/charts-charting-excel/167924-get-chart-item-returning-strange-results.html)

Laura Battarbee

GET.CHART.ITEM returning strange results
 
I have some functionality written in VB that I am re-writing in C#, but I am
getting a different result from the GET.CHART.ITEM macro for the exact same
chart series point. This is running in Excel 2003.

An example:

VB CODE: -- result is 337.5

Dim returnValue as variant

Series.points(1).select

returnValue = Application. ExecuteExcel4Macro("GET.CHART.ITEM(1,1)")

C# CODE: -- result is 309.25

Series.points(1).select

object returnValue = _application.ExecuteExcel4Macro(("GET.CHART.ITEM(1 ,1)");

Another interesting note is that I run the same C# code on the same chart
point in Excel 2007 and I get another result again! (196)

I understand this macro to be the following:

/*

*GET.CHART.ITEM (x_y_index, point_index, item_text)

*

* Returns the vertical or horizontal position of a point on
a chart item.

* Position is measured in points; a point is 1/72nd of an
inch.

*

* x_y_index 1=horizontal 2 = vertical

* point_index 1=lower 2 = upper or right

* item_text i.e. "PLOT" would be the plot area. We
leave this out so it takes the selection

*/

So I should be getting the horizontal lower point of the selected point in
the series.

Why would I be getting different results?

Thanks,


All times are GMT +1. The time now is 09:46 PM.

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