Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

How to reproduce old-style preset gradients

Problem

There used to be a variety of available pre-set gradients in PPT but they're no longer available in more recent versions.

Solution

Here's a bit of code that will create samples of each preset gradient and show you the transparency, stops, and RGB colors needed to re-create them. You could also use the resulting file as a source to pick up with the formatting paintbrush and apply to other shapes.

Or just download the finished sample presentation (PresetGradientSpecs) if you prefer.

Sub ShowMeTheGrads()

' Start with a 24-slide presentation
' 1 shape on each slide (ie a full-slide rectangle)

    Dim lPSGradType As Long
    Dim lGradStop As Long
    Dim lShape As Long
    Dim sTemp As String
    Dim lRed As Long
    Dim lGreen As Long
    Dim lBlue As Long

    For lPSGradType = 1 To 24  ' there are 24 preset gradient types
        sTemp = ""
        With ActivePresentation.Slides(lPSGradType).Shapes(1)
            .Fill.PresetGradient msoGradientHorizontal, 2, lPSGradType
            sTemp = "Gradient Type " & lPSGradType & vbCr
            With .Fill.GradientStops
                sTemp = sTemp & "Gradient stops:" & vbTab & CStr(.Count) & vbCr
                For lGradStop = 1 To .Count
                    sTemp = sTemp & "Stop #:" & vbTab & CStr(lGradStop) & vbCr
                    sTemp = sTemp & "Position: " & vbTab & CStr(.Item(lGradStop).Position) & vbCr
                    sTemp = sTemp & "Transparency: " & vbTab & CStr(.Item(lGradStop).Transparency) & vbCr
                    Call LongColorToRGB(lRed, lGreen, lBlue, .Item(lGradStop).Color.RGB)
                    sTemp = sTemp & "Color RGB: " & vbTab & "R: " & lRed & " / G: " & lGreen & " / B: " & lBlue & vbCr
                Next
            End With
            With .TextFrame.TextRange
                .Font.Size = 14
                .Text = sTemp
                .ParagraphFormat.Alignment = ppAlignLeft
            End With
        End With    ' Slide(lPSGradType)
    Next

End Sub

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

Sub LongColorToRGB(ByRef pRed As Variant, _
                   ByRef pGreen As Variant, _
                   ByRef pBlue As Variant, _
                   ByVal pRGBColor As Long)
' Returns the R, G, B components of an RGB Long value
' Note:  if long > 16777214, returns 255s for all three values

    pRed = pRGBColor Mod 256
    pGreen = pRGBColor \ 256 Mod 256
    pBlue = pRGBColor \ 65536 Mod 256

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2017 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

How to reproduce old-style preset gradients
http://www.pptfaq.com/FAQ01251-How-to-reproduce-old-style-preset-gradients.htm
Last update 24 April, 2017
Created: 24 April, 2017