none
How to programmatically access "Chart Elements' dropdown selected value in PowerPoint 2007? RRS feed

  • Question

  • Hi,

    Is there is any way to programmatically access "Chart Elements' dropdown selected value in PowerPoint 2007 using VBA?

     

    In advance appreciate your help and time.

     

    Regards,

    Ramesh

     

    Friday, March 11, 2011 8:10 PM

Answers

  • In case some one is interested, I have found a way to read the "Chart Elements" dropdown selected value using "AccessibleChildren" and "IAccessible" APIs.

    I will post the working version as soon as its ready.

    thanks for your help.

    Ramesh

    • Marked as answer by Bessie Zhao Friday, March 18, 2011 11:08 AM
    Monday, March 14, 2011 10:20 PM

All replies

  • Hello Ramesh,

    Thanks for posting. Would you please tell us more information about "Chart Elements" dropdown selected value? So I could get a better understanding on this issue. Then I will do some research to ensure if there is a way to programmatically access such value.

    Actually, in this forum, there are also few experts on PowerPoint programming issues. However, I will try to give you some useful information. So, I also recommend you could try to ask in Answer site. Although that answer site is for end-user issues, you will also find more PowerPoint specialists on programming issues.

    Microsoft Office PowerPoint:
    http://answers.microsoft.com/en-us/office/forum/office_2007-powerpoint.

    If you have any concern on this post, just feel free to follow up. Have a nice day.


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 14, 2011 9:41 AM
  • Thanks Bessie,

    What we are trying to find out is, the data series that user has selected. Currently in PowerPowint object model doesn't provide this information. If user selects perticular data series, and if we do activewindow.Selection, it always returns you the chart are and not the actual selected data series.

    We have a requirement, where user wants to apply our custom colors to only selected data series. without knowing which data series user has selected we won't be able to do that.

    If I execute following line of code, it will apply the fill color to chart area

    activewindow.Selection.ShapeRange(1).Fill.ForeColor.RGB = rgb(255,1,1)

    where as it should do the following

    activewindow.Selection.ShapeRange(1).Chart.SeriesCollection(2).format.Fill.ForeColor.RGB = rgb(255,1,1)

    In this case user had selected second data series. since we don't know that user had selected second data series we can not apply fill color to that specific series.

    When I ask about "Chart Elements" dropdown selected value, what I meant to say is, If you select a perticular data series, if you click on Format ribbon, you will see in PowerPoint, at left hand cornar a "Char Elements" dropdown where you can see all the elements and it will show the selected element is the one that user has selected, in this case series "Series 2".

    We wanted to see is there any option available that we can read this information. I don't know whether object model support this or not.

    PowerPoint object model also has following API which we tried but not luck. the Chart.GetChartElemets API does provide this kind of information, but it required 2 input parameters, the selected elements "X" and "Y" positions. Difficult to get that info. I even tried GetCursorPos Win32 API to find out "X" and "Y" positions, but "GetCursorPos" API gives screen position, which is not what "GetChartElemets" API is expecting.

    Hope if you understand the problem definition and get any workaround/solution.

    Appreciate your help and time.

    Regards,

    Ramesh

    • Proposed as answer by Bessie Zhao Wednesday, March 16, 2011 10:19 AM
    • Unproposed as answer by Bessie Zhao Wednesday, March 16, 2011 10:19 AM
    Monday, March 14, 2011 6:36 PM
  • In case some one is interested, I have found a way to read the "Chart Elements" dropdown selected value using "AccessibleChildren" and "IAccessible" APIs.

    I will post the working version as soon as its ready.

    thanks for your help.

    Ramesh

    • Marked as answer by Bessie Zhao Friday, March 18, 2011 11:08 AM
    Monday, March 14, 2011 10:20 PM
  • Hello again Ramesh,

    Thanks for your further information. By looking through PowerPoint object model, there is no such a property exposed by it to access selected value from "Chart Elements" dropdown.

    For more information about Ribbon Accessibility, please see Cindy's post in this thread: http://social.msdn.microsoft.com/Forums/en/vsto/thread/0e987588-abd6-4902-8ea1-ce695203bb7e.

    Hope it could help you more or less. Have a nice day.


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 15, 2011 9:45 AM