How to change the shape selection on another slide? - vba

How can I change the shape selection on another slide programmatically?
For example:
My current selection is on the shape 5 (the shape with id = 5) of the slide 3. How can I switch the selection on the shape 6 (the shape with id = 6) of the slide 2 programmatically?
Note: I am writing code in C#, VS Ultimate 2013, PowerPoint 2013

Related

VBA Powerpoint: Can i hide shapes randomly on a slide?

you can use VBA to hide shapes: VBA PowerPoint Display and Hide Shapes
But can you hide shapes randomly on a slide (all but one specific)?
I donĀ“t know how to make a random on a
ActivePresentation.Slides("Slide1").Shapes("Rectangle 1").Visible = False
I aspect, that i can hide a random shape on the actual slide by click(the Shape must have to be a visible shape before, so that another start of the code does hide randomly the next visible shape and not the hidden shape again).

VBA Macro to fill the selection range with color from shape color

I hide the toolbar, however need, fill the color menu. Whether possible to create a shape as the button with color and fill the selection shape into range selection cell from mouse
I have plane provide 3 different colors by using shape as a button, example Blue, Red and Black and if I select B:1 or A23 and click one of three colors shape the select range will fill by the same color. ( When I select range cell B:1 then click Red Shape, the cell B:1 will fill with Rd Color.

How to set PowerPoint chart Point text labels to match marker colors?

In an X-Y scatter plot, I manually add text labels to data points via Point.DataLabel. Unfortunately I find that when points are crowded then it can be difficult to tell which series a label belongs to. Therefore I want to color my text labels to match the markers.
I am happy with the default markers and their colors, but unfortunately they contain MarkerForegroundColor = -1 and MarkerForegroundColorIndex = 0, no matter which series I look at. Furthermore, Application.ActivePresentation.ColorSchemes is empty. I note that point.MarkerStyle = xlMarkerStyleAutomatic.
I found that the colors correspond to the accent colors in the active Theme (only available in PowerPoint 2007 onwards):
presentation.SlideMaster.Theme.ThemeColorScheme.Colors(MsoThemeColorSchemeIndex.msoThemeAccent1 + series_i % 6);

Capture which shape was clicked on in powerpoint

I have a PowerPoint presentation in which some slides contain multiple shapes for the user to click on.
I want to capture which shape is clicked. I am able to capture if shape has test on it using macro but what if it shape contains any image?
Every shape on a slide has a unique ID property that you can examine to determine which shape is selected.
Or you can add a tag to the shape beforehand:
ActiveWindow.Selection.ShapeRange(1).Tags.Add "MyName", "MyValue"
then
If ActiveWindow.Selection.ShapeRange(1).Tags("MyName") = "MyValue" Then
' Whatever

Cropping an image in Powerpoint using VBA

I need to crop an image on a Powerpoint slide using VBA - in my particular case I'm cropping from the top and left edges.
Can anyone offer any advice?
The following commands will crop 10 points off of each edge of the shape:
With ActivePresentation.Slides(1).Shapes(1)
.PictureFormat.CropLeft = 10
.PictureFormat.CropTop = 10
.PictureFormat.CropRight = 10
.PictureFormat.CropBottom = 10
End With
Note that this will crop shape number 1 on slide 1. If you want to crop the currently selected shape, use the following as the first line instead:
With ActiveWindow.Selection.ShapeRange(1)
See additional information on the CropBottom/etc. properties here:
https://learn.microsoft.com/en-us/office/vba/api/powerpoint.pictureformat.cropbottom