Microsoft Office Tutorials and References
In Depth Information
Example 21-3. Code in the Chart Sheet's Code Module
various chart types, so that we can determine which chart type is most appropriate for a particular
Start by creating a chart (with some data such as that in Figure 21-6 ) in a chartsheet. Then add the
code in Example 21-3 to the chart sheet's code module.
Example 21-3. Code in the Chart Sheet's Code Module
Option Explicit
Dim bPause As Boolean
Sub ScrollChartTypes()
Dim iType As Integer, sName As String
Dim fr As Integer
fr = FreeFile
Open ThisWorkbook.Path & _
"\charttypes.txt" For Input As #fr
Do While Not EOF(fr)
Input #fr, iType, sName
On Error Resume Next
ActiveChart.ChartType = iType
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = _
iType & " -- " & sName
Delay 2
If bPause Then
Loop Until bPause = False
End If
Close fr
End Sub
Sub Delay(rTime As Single)
'Delay rTime seconds (min=.01, max=300)
Dim OldTime As Variant
'Safty net
If rTime < 0.01 Or rTime > 300 Then rTime = 1
OldTime = Timer
Loop Until Timer - OldTime >= rTime
End Sub
Private Sub Chart_MouseDown(ByVal Button As Long, ByVal Shift As Long,
ByVal X As Long, ByVal Y As Long)
If Button = xlPrimaryButton Then _
Search JabSto ::

Custom Search