Microsoft Office Tutorials and References
In Depth Information
Example 21-10. The Declarations Section of the basDataLabels Code Module
MsgBox "Active workbook has no charts. Exiting.", vbInformation
Exit Sub
End If
On Error GoTo NoChartActive
Set oChart = ActiveChart
If Not oChart Is Nothing Then
' Check for data series
cSeries = oChart.SeriesCollection.Count
If cSeries = 0 Then
MsgBox "Active chart has no data series.", vbInformation
Exit Sub
End If
' If so, display dialog
dlgDataLabels.Show
Else
MsgBox "This utility requires that a chart be selected.",
vbInformation
End If
Exit Sub
NoChartActive:
MsgBox "This utility requires that a chart be selected.",
vbInformation
Exit Sub
End Sub
After creating basDataLabels , you should create the dialog in Figure 21-34 , name it
dlgDataLabels , and assign the string "Set Data Labels" to its Caption property. We have
created several custom dialogs earlier in the topic, so we will not go into any details here. (You
can design your dialog differently if you wish. There is nothing sacred about my design.) The
control names are:
CmdCancel
For the Cancel button
CmdSetLabels
For the Set Labels button
cmdUndo
For the Undo button
LblSeries
For the "Choose a Series:" label
LstSeries
For the list box
 
Search JabSto ::




Custom Search