none
PPT identify active shape RRS feed

  • Question

  • Hello,

    is there anyone who can tell me how to identify the active_shape in the active slide via VBA? Im unable to find the corresponding code: sh = activewindow.view.slide.shapes.........

    Thx

    Oliver




    • Edited by Odido Wednesday, March 12, 2014 2:45 PM
    Wednesday, March 12, 2014 2:44 PM

Answers

  • Hi,

    >>There is an active slide. On this slide is at least one shape. One and only one of these shapes is active.<<

    In fact, we could only selecte a shape to activate it in PowerPoint. There is no Activate method of Shape Object in PowerPoint Object Model. 

    Do you mean the “active” as “selected”? If so, we could resort to Selection.ShapeRange Property which returns a ShapeRange object that represents all the shape objects that have been selected on the specified slide.

    Here is a sample to access and show the name of the selected/active shape in active slide for your reference.

    Sub GetSelectedShapeInfo()
    Dim shp As Shape
    
    If ActiveWindow.Selection.Type = ppSelectionNone Then
       MsgBox "Please select objects", vbExclamation, "Make Selection"
    Else
       For Each shp In ActiveWindow.Selection.ShapeRange
           MsgBox shp.Name
       Next shp
    End If
    
    End Sub


    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.

    Thursday, March 13, 2014 3:00 AM
    Moderator

All replies

  • Hello Odido,

    You can use the SlideId property of the Slide class to identify slides uniquely.

    Wednesday, March 12, 2014 4:41 PM
  • Hello Eugene,

    I don't want to identify the SLIDE, I need to identify the active SHAPE!

    In other words: There is an active slide. On this slide is at least one shape. One and only one of these shapes is active. How can the programm find out, which of the shapes is active?

    Oliver

    Wednesday, March 12, 2014 4:45 PM
  • Hi,

    >>There is an active slide. On this slide is at least one shape. One and only one of these shapes is active.<<

    In fact, we could only selecte a shape to activate it in PowerPoint. There is no Activate method of Shape Object in PowerPoint Object Model. 

    Do you mean the “active” as “selected”? If so, we could resort to Selection.ShapeRange Property which returns a ShapeRange object that represents all the shape objects that have been selected on the specified slide.

    Here is a sample to access and show the name of the selected/active shape in active slide for your reference.

    Sub GetSelectedShapeInfo()
    Dim shp As Shape
    
    If ActiveWindow.Selection.Type = ppSelectionNone Then
       MsgBox "Please select objects", vbExclamation, "Make Selection"
    Else
       For Each shp In ActiveWindow.Selection.ShapeRange
           MsgBox shp.Name
       Next shp
    End If
    
    End Sub


    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.

    Thursday, March 13, 2014 3:00 AM
    Moderator
  • Hi Luna,

    that's exactly what I was looking for. Thank you very much and have a nice weekend.

    Oliver

    Friday, March 14, 2014 6:50 PM