Hi there,
I am trying to write code that will read chart properties from one chart and apply them to others. All the code is working execpt code to try to read and apply major grid line properties. I am using excel 2003 on windows XP. When I copy the "ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle" to a variable and use a msgbox to display that variable it displays the value as "-4118" when I read it from a chart with dashed gridlines. I'm posting the code I'm trying to use. Any thoughts on what I'm doing wrong. Thanks in advance.<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shape id=_x0000_i1025 style="WIDTH: 12pt; HEIGHT: 15.75pt" type="#_x0000_t75" alt=""><v:imagedata o:href="http://www.excelforum.com/images/smilies/confused.gif" src="file:///C:\Temp\msohtml1\01\clip_image001.gif"></v:imagedata></v:shape>
Code:
Dim GridlinesColour As Variant
Dim GridlinesWeight As String
Dim GridlinesLineStyle As String
Sub CollectChartPropertiesFromChart()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesColour = ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesWeight = ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesLineStyle = ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle
End Sub
Sub ApplyChartProperties()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex = GridlinesColour
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight = GridlinesWeight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle = GridlinesLineStyle
End Sub<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
I am trying to write code that will read chart properties from one chart and apply them to others. All the code is working execpt code to try to read and apply major grid line properties. I am using excel 2003 on windows XP. When I copy the "ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle" to a variable and use a msgbox to display that variable it displays the value as "-4118" when I read it from a chart with dashed gridlines. I'm posting the code I'm trying to use. Any thoughts on what I'm doing wrong. Thanks in advance.<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shape id=_x0000_i1025 style="WIDTH: 12pt; HEIGHT: 15.75pt" type="#_x0000_t75" alt=""><v:imagedata o:href="http://www.excelforum.com/images/smilies/confused.gif" src="file:///C:\Temp\msohtml1\01\clip_image001.gif"></v:imagedata></v:shape>
Code:
Dim GridlinesColour As Variant
Dim GridlinesWeight As String
Dim GridlinesLineStyle As String
Sub CollectChartPropertiesFromChart()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesColour = ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesWeight = ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then GridlinesLineStyle = ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle
End Sub
Sub ApplyChartProperties()
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.ColorIndex = GridlinesColour
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.Weight = GridlinesWeight
If ActiveChart.Axes(xlValue).HasMajorGridlines Then ActiveChart.Axes(xlValue).MajorGridlines.Border.LineStyle = GridlinesLineStyle
End Sub<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com



