How to generate graph on a slide in PowerPoint on

2019-09-06 15:28发布

问题:

Issue Description: To generate a graph on a slide. In PowerPoint on Macintosh shapes.addchart or shapes.addchart2 methods are not defined.

Solution Tried: Generate chart dynamically on embedded Excel then paste it on slide. It is giving out of memory error.

Expected Resolution: An alternative to shapes.addchart method or some other work around to achieve the target.

Windows
OS: Windows 10 Pro Version 1607 (OS Build 14393.693)
Office: Microsoft Office 365 ProPlus, Version 1611 (Build 7571.2109)
PowerPoint: PowerPoint 2016 MSO (16.0.7571.7095) 32 bit

MAC OS: macOS Sierra, Version 10.12 Office: Office 365 PowerPoint: Version 15.30(170107)

Code Snippet:

Dim myChart As Chart
'xlLine=4
Set myChart = ActivePresentation.Slides(1).Shapes.AddChart(Type:=4).Chart

Error Message: “Method or data member not found”

回答1:

One possibility is to maintain a library of pre-made charts in a separate Powerpoint file. Open this file windowlessly, copy the needed chart, paste it into the desired slide in your target presentation, then close the "hidden" chart presentation.