Edit

Share via


TwoColorGradient method (Excel Graph)

Sets the specified fill to a two-color gradient.

Syntax

expression.TwoColorGradient (Style, Variant)

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 Specifies the gradient style. Can be one of the MsoGradientStyle constants.
Variant Required Long Specifies the gradient variant. Can be a value from 1 through 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, the Variant argument can only be either 1 or 2.

Example

This example sets the gradient, background color, and foreground color for the chart area fill on the chart.

With myChart.ChartArea.Fill 
 .Visible = True 
 .ForeColor.SchemeColor = 15 
 .BackColor.SchemeColor = 17 
 .TwoColorGradient msoGradientHorizontal, 1 
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.