1

How can I use PowerPoint macro to pick up the format of shape(1) in an active slide? I try this, but it doesn't work

Activewindows.ActiveSlide.Shape(1).pickup 

Please help me.

braX
  • 11,506
  • 5
  • 20
  • 33
New Bee
  • 25
  • 6

1 Answers1

2

I don't think Powerpoint has an active slide property like Excel has ActiveSheet, so you'll need to find the index of the active slide, which Powerpoint does provide:

ActiveWindow.View.Slide.SlideIndex

You can use that to get a reference to the slide with the slides collection:

ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex)

and you can use that to get the shapes collection for that slide:

ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex).Shapes

and you can get use the Type property of any shape in that collection:

ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex).Shapes(1).Type

Type is going to return a value from the MsoShapeType enumeration, so you'll need to reference that to find out a friendly shape name, for instance, 13 is msoPicture. Here's a link to that:

https://learn.microsoft.com/en-us/office/vba/api/office.msoshapetype

And here is a link to the Powerpoint object model reference.

https://learn.microsoft.com/en-us/office/vba/api/overview/powerpoint/object-model

Hope that helps. Let me know if that works for you.

Chris Strickland
  • 3,388
  • 1
  • 16
  • 18