|
- Sub ll1()
- Dim Pres As Presentation
- Dim Sld As Slide, ShpRng As ShapeRange
- Dim Arr1, Arr2
- Arr1 = Array("A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8")
- Arr2 = Array("M1", "MM2", "MMM3", "MMMM4")
- Dim xChart As Chart
- Dim Ww As Workbook
- ''
- Dim Sht As Worksheet
- Dim Rng As Range
- Dim ii, jj, Str
- Dim Arr(7)
- Set Pres = Application.ActivePresentation
- Set Sld = Pres.Slides(1)
- Set xChart = Sld.Shapes(2).Chart
-
-
- With xChart
- Debug.Print .Name
- .ChartData.Activate
- Set Ww = .ChartData.Workbook
-
- Set Sht = Ww.Worksheets(1)
- If .SeriesCollection.Count < 3 Then
- For ii = 1 To 4
- .SeriesCollection.NewSeries
- Next ii
- End If
- ''
-
- For ii = 4 To 1 Step -1
- For jj = 0 To 7
- Sht.Cells(ii + 1, jj + 2) = Format(Rnd(1), "h:mm")
- Next jj
- Next ii
- Set Rng = Sht.Range("b1:i5")
- '.SetSourceData Source:=Sht.Range("b1:i5"), PlotBy:=xlRows
- .SeriesCollection(1).XValues = Arr1 ' Sht.Range("b1:i1")
- .HasDataTable = True
- .HasLegend = False
- For ii = 4 To 1 Step -1
- .SeriesCollection(ii).Name = Arr2(ii - 1)
- Str = Sht.Cells(ii + 1, 1)
- Select Case ii
- Case 1, 2
- .SeriesCollection(ii).ChartType = xlColumnStacked
- Case 3, 4
- .SeriesCollection(ii).ChartType = xlLine
- .SeriesCollection(ii).AxisGroup = 2
- End Select
-
- Next ii
-
- End With
- End Sub
复制代码 |
|