PresetGradient Method

Applies To

FillFormat object.

Description

Sets the specified fill to a preset gradient.

Syntax

expression.PresetGradient(Style, Variant, PresetGradientType)

expression Required. An expression that returns a FillFormat object.

Style Required Long. The gradient style. Can be one of the following MsoGradientStyle constants: msoGradientDiagonalDown, msoGradientDiagonalUp, msoGradientFromCenter, msoGradientFromCorner, msoGradientHorizontal, or msoGradientVertical. (The constant msoGradientFromTitle is used only in PowerPoint.)

Variant Required Long. The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, this argument can be either 1 or 2.

PresetGradientType Required Long. The gradient type. Can be one of the following MsoPresetGradientType constants:

  • msoGradientBrass
  • msoGradientCalmWater
  • msoGradientChrome
  • msoGradientChromeII
  • msoGradientDaybreak
  • msoGradientDesert
  • msoGradientEarlySunset
  • msoGradientFire
  • msoGradientFog
  • msoGradientGold
  • msoGradientGoldII
  • msoGradientHorizon
  • msoGradientLateSunset
  • msoGradientMahogany
  • msoGradientMoss
  • msoGradientNightfall
  • msoGradientOcean
  • msoGradientParchment
  • msoGradientPeacock
  • msoGradientRainbow
  • msoGradientRainbowII
  • msoGradientSapphire
  • msoGradientSilver
  • msoGradientWheat

Example

This example adds a rectangle with a preset gradient fill to myDocument.

Set myDocument = ActiveDocument
myDocument.Shapes.AddShape(msoShapeRectangle, 90, 90, 140, 80) _
    .Fill.PresetGradient msoGradientHorizontal, 1, msoGradientBrass