Example The Declarations Section of the basData Labels Code Module

Option Explicit

Private Type utDataLabels HasDataLabel As Boolean Label As String FontName As String FontSize As Single Color As Long Bold As Boolean Italic As Boolean End Type

Public LabelsForUndo() As utDataLabels Public DataSeries As Series Public cPoints As Integer Public bCopyFormatting As Boolean Public oChart As Chart

Dim cSeries as Long

Note, in particular, the user-defined type declaration. This saves the original data labels for a possible Undo operation. It can hold not only the data label's text, but also the formatting options that can be set using this utility.

The LabelDataSeries procedure, which is shown in Example 21-11, first verifies that a chart sheet or embedded chart is selected. Then it sets the global variable oChart to refer to this chart. This variable will be used by the dialog, so it needs to be public. Next, it sets the global variable cSeries to the number of data series in the chart. If the chart has no data series, a message is displayed. If everything is satisfactory, the Set Data Labels dialog is displayed.

0 0

Post a comment