Hi All,
I have a line chart , where I have line A and Line B . I am writing a macro for auto-formatting of the lines like color of line A should be Black and Width is 1.25. For Line B I am setting few more properties like Color = RED , width =1.25 , Under Shadow property -- Transperency = 58% , Blur =0 , Distance = 21 .
But I am getting the error in the VBA code below . Error always coming on line Selection.Format.Line saying Object does not support this method or Property.
Can someone help please.
I have a line chart , where I have line A and Line B . I am writing a macro for auto-formatting of the lines like color of line A should be Black and Width is 1.25. For Line B I am setting few more properties like Color = RED , width =1.25 , Under Shadow property -- Transperency = 58% , Blur =0 , Distance = 21 .
But I am getting the error in the VBA code below . Error always coming on line Selection.Format.Line saying Object does not support this method or Property.
Can someone help please.
Code:
Sub ChartFormat()
'
' ChartFormat Macro
'
'
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorAccent1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
Application.CommandBars("Format Object").Visible = False
ActiveChart.Legend.LegendEntries(2).Select
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0.0400000215
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(192, 0, 0)
.Transparency = 0.0400000215
End With
With Selection.Format.Line
.Visible = msoTrue
.Weight = 1.25
End With
With Selection.Format.Shadow
.Type = msoShadow25
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 4
.OffsetX = 3.9993907806
.OffsetY = -0.0698096257
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0.5686300099
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow25
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 4
.OffsetX = 3.9993907806
.OffsetY = -0.0698096257
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0.5686300099
.Size = 110
End With
Selection.Format.Shadow.Type = msoShadow32
Selection.Format.Shadow.Type = msoShadow31
Selection.Format.Shadow.Type = msoShadow30
Selection.Format.Shadow.Type = msoShadow23
Selection.Format.Shadow.Type = msoShadow26
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 4
.OffsetX = -3
.OffsetY = 3.6739403974E-16
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0.3199999928
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 4
.OffsetX = -3
.OffsetY = 3.6739403974E-16
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 0
.OffsetX = -3
.OffsetY = 3.6739403974E-16
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 0
.OffsetX = -21
.OffsetY = 2.5717582782E-15
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 0
.OffsetX = 20.9968015983
.OffsetY = -0.3665005352
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 0
.OffsetX = 20.9968015983
.OffsetY = -0.3665005352
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0.5699999928
.Size = 100
End With
With Selection.Format.Shadow
.Type = msoShadow26
.Visible = msoTrue
.Style = msoShadowStyleOuterShadow
.Blur = 0
.OffsetX = 20.9968015983
.OffsetY = -0.3665005352
.RotateWithShape = msoFalse
.ForeColor.RGB = RGB(0, 0, 0)
.Transparency = 0.5699999928
.Size = 110
End With
End Sub