OneColorGradient method (Excel Graph)

Sets the specified fill to a one-color gradient.

Syntax

expression.OneColorGradient (Style, Variant, Degree)

expression Required. An expression that returns one of the objects in the Applies To list.

Parameters

Name Required/Optional Data type Description
Style Required MsoGradientStyle The gradient style for the specified fill. Can be one of the MsoGradientStyle constants.
Variant Required Long The gradient variant for the specified fill. Can be a value from 1 through 4, corresponding to the four variants listed on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be 1 or 2.
Degree Required Single The gradient degree for the specified fill. Can be a value from 0.0 (dark) through 1.0 (light).

Example

This example sets the chart's fill format.

With myChart.ChartArea.Fill 
 If .Type = msoFillGradient Then 
 If .GradientColorType = msoGradientOneColor Then 
 .OneColorGradient Style:=msoGradientFromCorner, _ 
 Variant:=1, Degree:=0.3 
 End If 
 End If 
End With

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.