在PowerPoint中创建一个简单的图表不起作用

时间:2016-09-14 06:37:54

标签: charts powerpoint

我有以下问题,我无法用PowerPoint创建一个简单的图表:

Sub CreateChart()
Dim myChart As Chart
Dim gChartData As ChartData
Dim gWorkBook As Excel.Workbook
Dim gWorkSheet As Excel.Worksheet

' Create the chart and set a reference to the chart data.
Set myChart = ActivePresentation.Slides(1).Shapes.AddChart.Chart
Set gChartData = myChart.ChartData

' Set the Workbook and Worksheet references.
Set gWorkBook = gChartData.Workbook
Set gWorkSheet = gWorkBook.Worksheets(1)

在线设置myChart = ActivePresentation.Slides(1)等以下错误: 运行时错误''           

在行中设置gChartData = myChart。如果我按下CtrL +空格,我就不会看到paramather ChartData,只是ChartArea。

某些东西不合适。我的参考是: Visual Basic For Applications Microsoft Excel 14.0对象库 OLE自动化 Microsofot Office 14.0对象库 Microsoft PowerPoint 14.0对象库 微软供稿 Microsoft Forms 2.0对象库

代码是从microsoft网站上复制的:

https://msdn.microsoft.com/en-us/library/office/ff973127%28v=office.14%29.aspx

我怎么可能使用微软的一些代码并且它不起作用......?非常令人沮丧。

此致

0 个答案:

没有答案