且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Excel复制到Powerpoint错误

更新时间:2023-02-15 11:06:56

您正在面对的问题是因为复制需要时间,下一行将被执行,并且没有找到

The problem that you are facing is because the copying is taking time and the next line is getting executed and it doesn't find anything in the clipboard to paste.

处理此问题的两种方法

方式1

Way 1

XLApp.Range("WS1Dash").Copy
DoEvents
Set ppShape = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteOLEObject, Link:=msoFalse)

方式2

XLApp.Range("WS1Dash").Copy
Wait 2
Set ppShape = PPSlide.Shapes.PasteSpecial(DataType:=ppPasteOLEObject, Link:=msoFalse)

并将其粘贴到您的程序的底部

And paste this at the bottom of your procedure

Private Sub Wait(ByVal nSec As Long)
    nSec = nSec + Timer
    While nSec > Timer
        DoEvents
    Wend
End Sub

没有帮助...