J
JimC
I'm trying to set the border properties of a chart series via
variables pulled from a "setup" worksheet but I'm getting an "Unable
to set the Weight property of the Border class" error.
Here's the relevant code snippets:
Option Explicit
' Property variables
Dim CxLine As Long
Dim WtLine As String
Dim StLine As String
' go and get the variables from the worksheet
' this part works and the variables get assigned the following values
' CxLine = 5
' WtLine = xlThin
' StLine = xlContinuous
' code continues to run
With .SeriesCollection.NewSeries
.Values = rngChtData
.XValues = rngChtXVal
.Name = Range(shtChartDef & "!" & rngSeriesName).Cells(RowNum)
.AxisGroup = xlPrimary
.Smooth = True
With .Border
.ColorIndex = CxLine
' ColorIndex is set correctly
.Weight = WtLine
' Error thrown here
' Locals window shows WtLine = xlThin
' changing line to 'Weight = xlThin or Weight = 2 works fine
.LineStyle = StLine
End With
.MarkerSize = 5
.Shadow = False
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
End With
I'm stumped - I'm missing something obvious here. Any ideas?
Jim.
variables pulled from a "setup" worksheet but I'm getting an "Unable
to set the Weight property of the Border class" error.
Here's the relevant code snippets:
Option Explicit
' Property variables
Dim CxLine As Long
Dim WtLine As String
Dim StLine As String
' go and get the variables from the worksheet
' this part works and the variables get assigned the following values
' CxLine = 5
' WtLine = xlThin
' StLine = xlContinuous
' code continues to run
With .SeriesCollection.NewSeries
.Values = rngChtData
.XValues = rngChtXVal
.Name = Range(shtChartDef & "!" & rngSeriesName).Cells(RowNum)
.AxisGroup = xlPrimary
.Smooth = True
With .Border
.ColorIndex = CxLine
' ColorIndex is set correctly
.Weight = WtLine
' Error thrown here
' Locals window shows WtLine = xlThin
' changing line to 'Weight = xlThin or Weight = 2 works fine
.LineStyle = StLine
End With
.MarkerSize = 5
.Shadow = False
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
End With
I'm stumped - I'm missing something obvious here. Any ideas?
Jim.