Originally Posted by
John Wilson
There's no point setting a gradient if both colors are the same
Transparency defaults to 0 so that is not needed
I have change the RGB for the forecolor so yo can see it works.
You need to say which version and whether it is running in show mode or edit (The code below is for edit only - for show change Set osld = ActiveWindow.Selection.SlideRange(1) TO
Set osld=SlideShowWindows(1).View.Slide
Sub Add_Format()
Dim osld As Slide
Dim oshp As Shape
On Error Resume Next
Set osld = ActiveWindow.Selection.SlideRange(1)
If Err <> 0 Then
MsgBox "Select a slide"
Exit Sub
End If
Set oshp = osld.Shapes.AddShape(Type:=msoShapeRectangle, Left:=350, Top:=460, Width:=360, Height:=50)
With oshp
.Fill.ForeColor.RGB = RGB(255, 255, 111)
.Fill.BackColor.RGB = RGB(255, 255, 255)
.Fill.TwoColorGradient msoGradientHorizontal, 1 'this does nothing if fore and backcolor are the same
.Line.Visible = msoFalse
End With
End Sub