Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to set chart series border property with variables read from cellvalues?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default How to set chart series border property with variables read from cell values?

xlThin is a built-in Constant (variable) with a fixed value of 2.
So your "WtLine" variable should be declared as a Long not a String.

However you don't need the WtLine variable as you can use
the xlThin constant anyplace in your code where a value of 2 is needed.
--
Jim Cone
Portland, Oregon USA


"JimC"
wrote in message
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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to set chart series border property with variables read fromcell values?

On Jul 22, 8:12*pm, "Jim Cone" wrote:
xlThin is a built-in Constant (variable) with a fixed value of 2.
So your "WtLine" variable should be declared as a Long not a String.


The clue was there but I missed it - when trying variants of WtLine
assignments I noticed that with WtLine = xlThin it's value was shown
as 2 in the flyover evaluation. I didn't put it together.
Declaring it as Long didn't work as it was a type mismatch with the
cell contents "xlThin" (string).
Changing the declaration to Variant solved it.
Thanks for the solution.
Jim.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Chart Series Values Property Size Limitation Pete Charts and Charting in Excel 9 January 14th 08 03:03 PM
Read series values range of a chart matelot Charts and Charting in Excel 2 May 15th 07 03:45 AM
Is there a property to get the values for a point in a chart series? Bruce Cooley Excel Programming 6 May 11th 06 11:21 PM
Excel VBA - Read the series' chart data ranges rcatarino[_2_] Excel Programming 0 April 6th 04 01:22 AM
Formula property of a series in a chart Ali[_2_] Excel Programming 2 November 14th 03 11:16 AM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"