1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Sub PPT_ChangeChart() With ActivePresentation.Slides(1) Dim oChart As Chart Dim oChartData As ChartData Dim gWorkBook As Excel.Workbook Dim gWorkSheet As Excel.Worksheet ''Chart對(duì)象 Set oChart = ActivePresentation.Slides(1).Shapes(1).Chart Set oChartData = oChart.ChartData oChartData.Activate Set gWorkBook = oChartData.Workbook Set gWorkSheet = gWorkBook.Worksheets( "Sheet1" ) gWorkSheet.Cells(2, 1).Value = "Product A" gWorkSheet.Cells(3, 1).Value = "Product B" gWorkSheet.Cells(4, 1).Value = "Product C" gWorkSheet.Cells(5, 1).Value = "Product D" gWorkSheet.Cells(6, 1).Value = "Product E" gWorkSheet.ListObjects( "Table1" ).Resize gWorkSheet.Range( "A1:D6" ) '設(shè)置圖標(biāo)數(shù)據(jù)源區(qū)域 gWorkBook.Application.Quit oChart.Refresh Set gWorkSheet = Nothing Set gWorkBook = Nothing Set oChartData = Nothing Set oChart = Nothing End With End Sub |
聯(lián)系客服