Link to home
Start Free TrialLog in
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.
Avatar of Harry Lee
Harry Lee
Flag of Canada image

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

Avatar of robtrue

ASKER

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

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robtrue

ASKER

Solution directly on target and it works!!