none
Identifying a Particular Shape on a Slide with VBA RRS feed

  • Question

  • Hello,

    Let's say I want to use VBA for PowerPoint to manipulate a bar chart on a slide.  There are 5 shapes on the slide, including the bar chart, but the bar chart is the only shape that is linked to an Excel spreadsheet.  When looping through the shapes on the slide, how do I identify the bar chart shape (that is, how do I know when the loop has reached the bar chart)?  I suppose I could use the type or name properties of the Shapes object, but wouldn't that require prior knowledge of the shape's type or name index?  Is there a way to identify whether a shape is linked to Excel?  Perhaps that would be a solution.  I see a LinkedOLEObject property in the PowerPoint Object Model Reference, but don't really understand what a Linked OLE Object or an OLE Object is.  I'm new to VBA so any advice would help.  Thanks!

    Monday, August 27, 2012 11:24 PM

Answers

  • By OleObjects you can take service from a different application (Server ) in the host application (Client).

    You can check the Type of all shape If it returns 3 then this is a chart (I get 3 from object browser)

    How you get the linked chart ?


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    • Marked as answer by Looshsmoot Tuesday, August 28, 2012 3:44 PM
    Tuesday, August 28, 2012 7:24 AM
    Answerer
  • In Power Point VBE - Press F2->get the "Shape" object by scrolling the left pane->get the Type by scrolling->Now click the MsoShapeType.

    Or you may put Type in Search Box and press enter.Lot of object/method/proerty will appear.One will relate to shape.


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    • Marked as answer by Looshsmoot Wednesday, August 29, 2012 5:45 PM
    Wednesday, August 29, 2012 6:16 AM
    Answerer

All replies

  • By OleObjects you can take service from a different application (Server ) in the host application (Client).

    You can check the Type of all shape If it returns 3 then this is a chart (I get 3 from object browser)

    How you get the linked chart ?


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    • Marked as answer by Looshsmoot Tuesday, August 28, 2012 3:44 PM
    Tuesday, August 28, 2012 7:24 AM
    Answerer
  • Thank you.

    By "linked" I meant the data in the chart is in an Excel sheet, the way all charts in PowerPoint are.

    How can I see all of the various "Types" and the associated index values using the Object Browser? 

    Tuesday, August 28, 2012 3:49 PM
  • In Power Point VBE - Press F2->get the "Shape" object by scrolling the left pane->get the Type by scrolling->Now click the MsoShapeType.

    Or you may put Type in Search Box and press enter.Lot of object/method/proerty will appear.One will relate to shape.


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    • Marked as answer by Looshsmoot Wednesday, August 29, 2012 5:45 PM
    Wednesday, August 29, 2012 6:16 AM
    Answerer