Avatar of robtrue
robtrueFlag for United States of America asked on

How to Set Excel 2007 Legend Format Properties in VBA

Using VBA code I need to set the following for the Legend on an Excel 2007 chart.
Legend Fill set to Gradient fill.
Shadow properties Transparency to 60%, Blur to 4 pts, Angle to 0 degrees, and Distance to 3 pts.
Microsoft ApplicationsMicrosoft OfficeMicrosoft Excel

Avatar of undefined
Last Comment
robtrue

8/22/2022 - Mon
Harry Lee

Use the following code

    ActiveSheet.ChartObjects("Chart 1").Activate
    With ActiveChart.Legend.Format.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorAccent1
        .ForeColor.TintAndShade = 0.3399999738
        .ForeColor.Brightness = 0
        .BackColor.ObjectThemeColor = msoThemeColorAccent1
        .BackColor.TintAndShade = 0.7649999857
        .BackColor.Brightness = 0
        .TwoColorGradient msoGradientHorizontal, 1
    End With
    With ActiveChart.Legend.Format.Shadow
        .Type = msoShadow25
        .Visible = msoTrue
        .Style = msoShadowStyleOuterShadow
        .Blur = 4
        .OffsetX = 3
        .OffsetY = 0
        .RotateWithShape = msoFalse
        .ForeColor.RGB = RGB(0, 0, 0)
        .Transparency = 0.599999994
        .Size = 100
    End With

Open in new window

ASKER
robtrue

Compile error: Method or member not found.
.ForeColor.Brightness = 0
.BackColor.Brightness = 0
Is there a another way to express brightness?
ASKER CERTIFIED SOLUTION
Harry Lee

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
robtrue

Solution directly on target and it works!!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck