我在PowerPoint中创建了一个宏来打开Excel工作簿,遍历工作簿中的工作表,创建PowerPoint图表并使用Excel工作表中的数据填充它们 . 为了说清楚,宏是从PowerPoint运行的 .
我现在需要制作数据范围(从Excel传输到Powerpoint工作表时)和PowerPoint图表数据范围是动态的 . 例如 . 因为每个Excel工作表范围不同,因此每个PowerPoint图表数据范围都不相同 .
以下是我的宏:
Sub CreateChartAllWKsv3()
'Create variables
Dim myChart As Chart
Dim pptChartData As ChartData
Dim pptWorkBook As Excel.Workbook
Dim pptWorkSheet As Excel.Worksheet
Dim xlApp As Excel.Application
Dim xlWB As Workbook
Dim xlWS As Worksheet
Dim CurSlide As Slide 'new from update
Dim LastRow As Long ' 8/22
Dim LastColumn As Long ' 8/22
' Create new excel instance and open relevant workbook
Set xlApp = New Excel.Application
xlApp.Visible = True 'Make Excel visable
Set xlWB = xlApp.Workbooks.Open("C:\ExcelWo