Hi,
how does one determine the shape index of the currently selected shape in powerpoint with VBA?
I have spent an hour looking for an answer to what I thought would be a straightforward problem, including reading up on shapes and their methods and properties but a solution has escaped me. I apologize if this answer is out there, but none of my queries have yielded any answer other than how to solve the querier's problem by not using the shape's index.
I need to go through a slide deck and crop only the selected picture on the current slide that I am working on.
There is no systematic ordering or naming of the images on individual slides.
There may be multiple images of which I may wish to crop one or two but not all.
So I believe that I need a macro that will only act on the currently selected picture.
I cobbled together the following code which works with a hard coded shape index for the specific slide I have been experimenting on....
Sub CropSelectedImage()
CurrentSlide = ActiveWindow.View.Slide.SlideNumber
Set myDocument = ActivePresentation.Slides(CurrentSlide)
'Hard coded version works but
current_shape_index = 4 '<<<<<<< need code here to Get Selected Shape Index
myDocument.Shapes(current_shape_index).PictureFormat.CropTop = 20
End Sub
Thank you - Mark