user154468
user154468

Reputation:

Manipulating excel 2007 chart grid lines in VBA

Using Excel 2007, is it possible to change the transparency of chart grid lines using VBA or VB.NET?

I have the following code, which throws an exception on the last line:

Dim axis As Excel.Axis = chart.Axes(Excel.XlAxisType.xlCategory)
axis.HasMajorGridlines = True
axis.MajorGridlines.Border.Color = Color.Gray.ToArgb
axis.MajorGridlines.Border.LineStyle = Excel.XlLineStyle.xlContinuous
axis.MajorGridlines.Format.Fill.Transparency = 0.8

( Of course, this code is in VB.NET )

Thanks!

Upvotes: 0

Views: 11215

Answers (1)

Paul Pringle
Paul Pringle

Reputation:

In the last line of your code, I think it should be

axis.MajorGridlines.Format.Line.Transparency = 0.8

That works for me and adjusts the transparency of the vertical gridlines.

Upvotes: 1

Related Questions