Hi

In the PPT interface, if I group a selection of shapes, lets say three filled circled in a line and then set the Fill for the group to be gradient - say dark blue on the left fading to light blue on the right - then the gradient spans the circles. The left one is mostly dark, the right is mostly light, the middle one is in between.

I have code that can apply a specific gradient design to a shape. It works fine for individual shapes.

If I apply that to a shape that is a group I would expect to see the same as described above. Unfortunately I don't, what I get is each shape in my group shaded to the gradient, so for the example above, each circle is dark blue on the left and light blue on the right.

Does anyone know how to set the gradient across the shapes using VBA, the same as the interface can do?

Here is my code ... modified a bit as is client bespoke ...

It assumes you have a single shape (which might be a group) selected before it runs ...

Public Sub TestGradExample()


    Dim shpTgt  As Shape
    Dim iStyle          As Integer
    Dim iVariant        As Integer
    Dim iAngle          As Integer
    
    Set shpTgt = ActiveWindow.Selection.ShapeRange(1)
    
    With shpTgt.Fill
        
        iStyle = 2 'these are fetched based on choice user makes really but these values are valid for this test
        iVariant = 1
        iAngle = 0
        
        'get a gradient going
        .OneColorGradient iStyle, iVariant, iAngle
        
        'Modify it (this is done as a loop in the real code but equates to this)
        
        .GradientStops(1).Color.RGB = RGB(255, 0, 0)
        .GradientStops(1).Position = 0
        .GradientStops(1).Transparency = 0
        
        .GradientStops.Insert RGB(0, 255, 0), 0.5, 0
        .GradientStops.Insert RGB(0, 0, 255), 1, 0
        
        
    End With


    Set shpTgt = Nothing
    
End Sub
If I run that on one shape I get red on the left, lots of green and blue on the right

If I run it against a group of two or more shapes next to each other, each shape gets the above not a gradient across them all.

Thanks

Simon