Encontrar el objeto activo en Power Point

Encontré este código que se me hizo buenísimo.

Sub DetermineActiveShape()
'PURPOSE: Determine the currently selected shape in PowerPoint
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault

Dim ActiveShape As Shape
Dim shp As Shape

'Determine Which Shape is Active
  If ActiveWindow.Selection.Type = ppSelectionShapes Then
    'Loop in case multiples shapes selected
       For Each shp In ActiveWindow.Selection.ShapeRange
         'ActiveShape is first shape selected
            Set ActiveShape = shp
            Exit For
       Next shp
  Else
    MsgBox "There is no shape currently selected!", vbExclamation, "No Shape Found"
  End If

'Do Something with the ActiveShape
 ' ActiveShape.TextFrame2.TextRange.Text = "Hello!"
Debug.Print "Top: " & ActiveShape.Top & " Left: " & ActiveShape.Left & "Height: " & ActiveShape.Heigth & " Width: " & ActiveShape.Width
End Sub

Pego una imagen en PowerPoint, la formateo como me gusta y si quiero saber exactamente esos datos que aparecen en la ventana inmediata, le doy click al objeto y corro esta macro.

Deja una respuesta

Tu dirección de correo electrónico no será publicada.

*