Microsoft Office Tutorials and References
In Depth Information
Example 21-12. The Initialize Event Procedure
For the "Choose a Range for the Labels" label
For the Reference Editor control
For the frame
For the Link option button
For the Copy option button
For the Copy Formatting check box
You should not have any trouble determining which name goes with which control (which is a
benefit of using a naming convention, after all).
Most of the code behind the dialog is pretty straightforward. The Initialize event, shown in
Example 21-12 , first fills the list box ( lstSeries ) with a list of all of the data series in the chart
oChart . Then it initializes some of the other controls.
Example 21-12. The Initialize Event Procedure
Private Sub UserForm_Initialize()
' oChart is set to refer to the active chart
' cSeries has count of series
Dim ds As Series
' Fill the lstSeries
For Each ds In oChart.SeriesCollection
lstSeries.AddItem ds.Name
optCopy.Value = True
chkOption.Caption = "Copy Formatting"
chkOption.Accelerator = "F"
cmdUndo.Enabled = False
End Sub
We want the caption (and accelerator key) of the check box at the bottom of the dialog to change
based on the choice of option button (Link or Copy). Hence, we need some code in the appropriate
Click events, as shown in Example 21-13 .
Example 21-13. The Option Buttons' Click Events
Search JabSto ::

Custom Search