Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Working with Charts yet again

I'm back again with a follow up question on manipulating charts and their
series in VBA (Excel 97).

The following code is not doing what I'm expecting:
(chBoxPlot is type Chart, rngOut is type Range, frmBoxPlot is a userform and
chkEmbedded is a checkbox control)

Set chBoxPlot = Charts.Add
chBoxPlot.SetSourceData Source:=rngOut, PlotBy:=xlRows
chBoxPlot.ChartType = xlLineMarkers

If frmBoxPlot.chkEmbedded Then 'user wants embedded chart
Set chBoxPlot = chBoxPlot.Location(Whe=xlLocationAsObject,
Name:=SheetName)
End If

' *** This is where things break down - nothing happens

For Var = 1 To NumVars
chBoxPlot.SeriesCollection(Var).LineStyle = xlNone
Next Var

With chBoxPlot.ChartGroups(1)
.HasDropLines = False
.HasHiLoLines = True
.HasUpDownBars = True
.GapWidth = 150
End With

The code creates the chart as expected, but the For Loop and With - End With
block do no do what I expect; i.e., they do not remove the lines connecting
the points nor produce HiLines and LowBars on the series.

And while I'm at it, why can't I use the .ChartGroups command to replace the
For Loop? In other words, since I want to operate on all the series in the
same way, shouldn't including .LineStyle = xlNone within the With/End With
block work?

And another while I'm at it: Any recommendations on a reference
manual/guide - I have the Wrox Excel 2003 VBA, but I'm not convinced it's
the best thing for me.

By the way Jon, if you're monitoring - I couldn't find your reply, but thank
you for taking the time to email me.

Tony (george raft is just such a great name, I couldn't resist it.)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Working with Charts yet again

Hi Jeff

' *** This is where things break down - nothing happens

For Var = 1 To NumVars
chBoxPlot.SeriesCollection(Var).LineStyle = xlNone
Next Var


try:
chBoxPlot.SeriesCollection(Var).Border.LineStyle = xlNone

that would make a line type chart invisible! (you defined ChartType =
xlLineMarkers)

I assume "NumVars" is defined somehow

Regards,
Peter

"George Raft" wrote in message
...
I'm back again with a follow up question on manipulating charts and their
series in VBA (Excel 97).

The following code is not doing what I'm expecting:
(chBoxPlot is type Chart, rngOut is type Range, frmBoxPlot is a userform

and
chkEmbedded is a checkbox control)

Set chBoxPlot = Charts.Add
chBoxPlot.SetSourceData Source:=rngOut, PlotBy:=xlRows
chBoxPlot.ChartType = xlLineMarkers

If frmBoxPlot.chkEmbedded Then 'user wants embedded chart
Set chBoxPlot = chBoxPlot.Location(Whe=xlLocationAsObject,
Name:=SheetName)
End If

' *** This is where things break down - nothing happens

For Var = 1 To NumVars
chBoxPlot.SeriesCollection(Var).LineStyle = xlNone
Next Var

With chBoxPlot.ChartGroups(1)
.HasDropLines = False
.HasHiLoLines = True
.HasUpDownBars = True
.GapWidth = 150
End With

The code creates the chart as expected, but the For Loop and With - End

With
block do no do what I expect; i.e., they do not remove the lines

connecting
the points nor produce HiLines and LowBars on the series.

And while I'm at it, why can't I use the .ChartGroups command to replace

the
For Loop? In other words, since I want to operate on all the series in

the
same way, shouldn't including .LineStyle = xlNone within the With/End With
block work?

And another while I'm at it: Any recommendations on a reference
manual/guide - I have the Wrox Excel 2003 VBA, but I'm not convinced it's
the best thing for me.

By the way Jon, if you're monitoring - I couldn't find your reply, but

thank
you for taking the time to email me.

Tony (george raft is just such a great name, I couldn't resist it.)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Working with Charts yet again



I'm back again with a follow up question on manipulating charts and their
series in VBA (Excel 97).

The following code is not doing what I'm expecting:
(chBoxPlot is type Chart, rngOut is type Range, frmBoxPlot is a userform and
chkEmbedded is a checkbox control)

Set chBoxPlot = Charts.Add
chBoxPlot.SetSourceData Source:=rngOut, PlotBy:=xlRows
chBoxPlot.ChartType = xlLineMarkers

If frmBoxPlot.chkEmbedded Then 'user wants embedded chart
Set chBoxPlot = chBoxPlot.Location(Whe=xlLocationAsObject,
Name:=SheetName)
End If

' *** This is where things break down - nothing happens


Step through the code, use the Locals window to check your variables. Also, do the
series chart the data you expect them to?

For Var = 1 To NumVars
chBoxPlot.SeriesCollection(Var).LineStyle = xlNone
Next Var


SeriesCollection(Var).LineStyle didn't raise an error?

With chBoxPlot.ChartGroups(1)
.HasDropLines = False
.HasHiLoLines = True
.HasUpDownBars = True
.GapWidth = 150
End With

The code creates the chart as expected, but the For Loop and With - End With
block do no do what I expect; i.e., they do not remove the lines connecting
the points nor produce HiLines and LowBars on the series.


How many series do you have?

And while I'm at it, why can't I use the .ChartGroups command to replace the
For Loop? In other words, since I want to operate on all the series in the
same way, shouldn't including .LineStyle = xlNone within the With/End With
block work?


The ChartGroup object has no Border or LineStyle members.

And another while I'm at it: Any recommendations on a reference
manual/guide - I have the Wrox Excel 2003 VBA, but I'm not convinced it's
the best thing for me.

By the way Jon, if you're monitoring - I couldn't find your reply, but thank
you for taking the time to email me.


http://groups-beta.google.com/group/...c1d7d086513c76

Tony (george raft is just such a great name, I couldn't resist it.)



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
Charts.add stopped working Carlo Charts and Charting in Excel 4 February 15th 07 03:52 PM
Pivot Charts on Web not working [email protected] Charts and Charting in Excel 0 August 7th 06 08:07 AM
Working with two charts LESLEY EDWARDS New Users to Excel 1 May 9th 06 06:40 AM
Working with Charts J. Stone Excel Discussion (Misc queries) 1 April 6th 05 09:06 AM
Working with Charts George Raft Excel Programming 1 December 22nd 04 10:24 PM


All times are GMT +1. The time now is 06:36 AM.

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"