If you manually set your default shape to have a gradient fill then the following will work. It appears the object model is broken in as much as setting TwoColorGradient does not alter the Solid setting and makes calls to gradientstop properties fail.
Sub EDIT_ITEM()
Dim shpTemp As Shape
ActiveSheet.Shapes("item").Select
Selection.Copy
Range("F15").Select
ActiveSheet.Paste
Selection.Name = Range("E5").Value & Range("F5").Text
Set shpTemp = ActiveSheet.Shapes(Range("E5").Value & Range("F5").Text)
With shpTemp.Fill
.Visible = msoTrue
.TwoColorGradient msoGradientHorizontal, 1
With .GradientStops(1)
.Color.RGB = RGB(Split(Range("G5"), ",")(0), Split(Range("G5"), ",")(1), Split(Range("G5"), ",")(2))
.Position = 0
End With
With .GradientStops(2)
.Color.RGB = RGB(Split(Range("H5"), ",")(0), Split(Range("H5"), ",")(1), Split(Range("H5"), ",")(2))
.Position = 1
End With
End With
End Sub
you can set RGB directly
.Fill.ForeColor.RGB = RGB(0, 255, 0)
Bookmarks