Microsoft Office Tutorials and References
In Depth Information
Example 21-16. The cmdUndo_Click Event Procedure
DataSeries.Points(i).HasDataLabel = True
DataSeries.Points(i).DataLabel.Text =
rngLabels.Cells(i).Value
If chkOption Then
bCopyFormatting = True
With DataSeries.Points(i).DataLabel.Font
.Name = rngLabels.Cells(i).Font.Name
.Size = rngLabels.Cells(i).Font.Size
.Bold = rngLabels.Cells(i).Font.Bold
.Italic = rngLabels.Cells(i).Font.Italic
.Color = rngLabels.Cells(i).Font.Color
End With
DataSeries.Points(i).DataLabel.NumberFormat = _
rngLabels.Cells(i).NumberFormat
Else
bCopyFormatting = False
End If
Next
End If
End Sub
The Undo command button's Click event, which is shown in Example 21-16 , restores the original
data labels that are saved in the DoDataLabels procedure.
Example 21-16. The cmdUndo_Click Event Procedure
Private Sub cmdUndo_Click()
' Restore labels for DataSeries
Dim i As Integer
For i = 1 To cPoints
If LabelsForUndo(i).HasDataLabel Then
DataSeries.Points(i).HasDataLabel = True
DataSeries.Points(i).DataLabel.Text = LabelsForUndo(i).Label
If bCopyFormatting Then
' Restore formatting
With DataSeries.Points(i).DataLabel.Font
.Name = LabelsForUndo(i).FontName
.Size = LabelsForUndo(i).FontSize
.Color = LabelsForUndo(i).Color
.Bold = LabelsForUndo(i).Bold
.Italic = LabelsForUndo(i).Italic
End With
End If
Else
DataSeries.Points(i).HasDataLabel = False
End If
Next
cmdUndo.Enabled = False
End Sub
 
 
Search JabSto ::




Custom Search