Microsoft Office Tutorials and References
In Depth Information
Example 21-9. The PrintSelectedCharts Procedure
It is important to note also that list boxes are 0-based, meaning that the first item is item 0.
However, our arrays are 1-based (the first item is item 1), so we must take this into account when
we move from a selection to an array member; to wit, selection i corresponds to array index i+1 .
Example 21-9. The PrintSelectedCharts Procedure
Sub PrintSelectedCharts()
' Print the selected charts in lstCharts
Dim i As Integer
Dim bNoneSelected As Boolean
bNoneSelected = True
If cCharts = 0 Then
MsgBox "No embedded charts in this workbook.", vbExclamation
Exit Sub
For i = 0 To lstCharts.ListCount - 1
If lstCharts.Selected(i) Then
bNoneSelected = False
' List box is 0-based, arrays are 1-based
Worksheets(sSheets(i + 1)). _
ChartObjects(sChartObjNames(i + 1)).Chart.PrintOut
End If
End If
If bNoneSelected Then
MsgBox "No charts have been selected from the list box.",
End If
End Sub
21.19 Example: Setting Data Series Labels
As you may know, data labels can be edited individually by clicking twice (pausing in between
clicks) on a data label. This places the label in edit mode, as shown in Figure 21-33 .
Figure 21-33. A data label in edit mode
Search JabSto ::

Custom Search