【发布时间】:2017-07-07 00:33:04
【问题描述】:
我正在使用此代码将 Excel 图表导出到 PowerPoint
Sub ChartsToPresentation()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer
Application.CutCopyMode = False
Set PPApp = GetObject(, "Powerpoint.Application.16")
Set PPSlide = PPApp.ActiveWindow.View.Slide
nv = PPApp.ActiveWindow.Selection.SlideRange.SlideIndex
ActiveChart.ChartArea.Select
Selection.Copy
ggg: Set shp = PPApp.ActivePresentation.Slides(nv).Shapes.PasteSpecial(DataType:=0)
If Err Then GoTo ggg
Application.CutCopyMode = False
End Sub
当我在一个循环中为许多不同的图表调用 sub 时,我经常收到一个错误 “剪贴板为空或包含可能无法粘贴的数据” .它看起来是复制和粘贴之间的延迟问题。
我用的是Win10 office 2016 64b
有解决办法吗?
我试过用 VB6 做,但看起来同样的问题
【问题讨论】:
标签: vba excel vb6 powerpoint