none
PowerPoint.Shape PowerPoint.Slide parent and child RRS feed

  • Question

  • Hello, could you tell me what are PowerPoint.Shape.Parent, and PowerPoint.Shape.Child, and PowerPoint.Slide used for? The PowerPoint.Shape.Parent is always pointing to the slide that contains the shape?

    If possible, could you please give some example to clarify these terms.

    Thanks.


    • Edited by chipbk11 Monday, October 27, 2014 4:59 PM
    Monday, October 27, 2014 4:37 PM

Answers

  • Hi Chipbk,

    Thanks for posting on MSDN forum.

    Here is the statement for shape.Parent:
    Returns the parent object for the specified object

    Based on my understanding, the shape was containted in the slide, normally the parent of the shape is the slide which contains the shape.

    And here is the statement for the Shape.Child:

    MsoTrue if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only.

    For example, if a shape was contained in a Canvas, this property returns MsoTrue. To create a shape in Canvas, we can create the canvas and shapes in Word application and copy them to the slide.

    Here is a sample to test whether the shape on the slide is a child shape:

    Debug.Print Application.ActivePresentation.Slides(2).Shapes("Oval 12").Child = msoTrue
    Set a = Application.ActivePresentation.Slides(2).Shapes("Oval 12").Parent

    Here is the screenshot for the slide:

    The result is true and the parent of the shape is the slide.

    PowerPoint.Slide represents a slide. The Slides collection contains all the Slide objects in a presentation. We can use this object to refer to the particular slide in the presentation.

    Hope it is helpful.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 28, 2014 9:00 AM
    Moderator

  • Hi Chipbk,

    >>How can we add a canvas programmatically? I don't see canvas shape in PowerPoint.Shapes.Add(...)<<

    As far as I know, there is method in PowerPoint Object Model to add a canvas progammatically. As a workaround, we can create it in Word document and copy it to the presentation with code.

    Also if you want PowerPoint Object Model to support it, you can submit the feedback from link below:
    Submit Feedback

    >>How about PowerPoint.Slide.Parent? It will refer to the presentation that contains the slide?<<

    Yes, you are right. Also you can get the sepcific object via debug the code. You can set the breakpoint at the line of "End Sub", and here is the code for your reference:

    Sub test()
    Set a = ActivePresentation.Slides(1).Parent
    End Sub

    Then you can right click the "a" and add it to watch like figure below:

    Also you can get more detail about PowerPoint Object model from link below:
    Object model reference (PowerPoint 2013 developer reference)

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by chipbk11 Friday, October 31, 2014 9:23 AM
    Wednesday, October 29, 2014 7:21 AM
    Moderator

All replies

  • Hi Chipbk,

    Thanks for posting on MSDN forum.

    Here is the statement for shape.Parent:
    Returns the parent object for the specified object

    Based on my understanding, the shape was containted in the slide, normally the parent of the shape is the slide which contains the shape.

    And here is the statement for the Shape.Child:

    MsoTrue if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only.

    For example, if a shape was contained in a Canvas, this property returns MsoTrue. To create a shape in Canvas, we can create the canvas and shapes in Word application and copy them to the slide.

    Here is a sample to test whether the shape on the slide is a child shape:

    Debug.Print Application.ActivePresentation.Slides(2).Shapes("Oval 12").Child = msoTrue
    Set a = Application.ActivePresentation.Slides(2).Shapes("Oval 12").Parent

    Here is the screenshot for the slide:

    The result is true and the parent of the shape is the slide.

    PowerPoint.Slide represents a slide. The Slides collection contains all the Slide objects in a presentation. We can use this object to refer to the particular slide in the presentation.

    Hope it is helpful.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 28, 2014 9:00 AM
    Moderator
  • Thanks for your answer.

    How can we add a canvas programmatically? I don't see canvas shape in PowerPoint.Shapes.Add(...)

    How about PowerPoint.Slide.Parent? It will refer to the presentation that contains the slide?

    • Marked as answer by chipbk11 Friday, October 31, 2014 9:23 AM
    • Unmarked as answer by chipbk11 Friday, October 31, 2014 9:23 AM
    Tuesday, October 28, 2014 9:49 AM

  • Hi Chipbk,

    >>How can we add a canvas programmatically? I don't see canvas shape in PowerPoint.Shapes.Add(...)<<

    As far as I know, there is method in PowerPoint Object Model to add a canvas progammatically. As a workaround, we can create it in Word document and copy it to the presentation with code.

    Also if you want PowerPoint Object Model to support it, you can submit the feedback from link below:
    Submit Feedback

    >>How about PowerPoint.Slide.Parent? It will refer to the presentation that contains the slide?<<

    Yes, you are right. Also you can get the sepcific object via debug the code. You can set the breakpoint at the line of "End Sub", and here is the code for your reference:

    Sub test()
    Set a = ActivePresentation.Slides(1).Parent
    End Sub

    Then you can right click the "a" and add it to watch like figure below:

    Also you can get more detail about PowerPoint Object model from link below:
    Object model reference (PowerPoint 2013 developer reference)

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by chipbk11 Friday, October 31, 2014 9:23 AM
    Wednesday, October 29, 2014 7:21 AM
    Moderator