View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier[_9_] Jon Peltier[_9_] is offline
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.)