Reputation: 184
I want to paste table from excel to powerpoint using vba. I am using powerpoint version 2007. I am able to successfully paste ppEnhancedmeta file. But getting problem while pasting to ppPasteDefault. ** It gives error "Shapes (unknown member): invalid request. clipboard is empty or contains data which may not be pasted here**
Sub excel_to_powerpoint()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Set PPApp = New PowerPoint.Application
PPApp.Visible = True
PPApp.Activate
Set PPPres = PPApp.Presentations.Add
Set PPSlide = PPPres.Slides.Add(1, ppLayoutBlank)
Sheet2.Range("A1:C5").Copy
For i = 1 To 50000: DoEvents: Next
PPSlide.Shapes.PasteSpecial ppPasteDefault
Set myshape = PPSlide.Shapes(PPSlide.Shapes.Count)
myshape.Left = 50
myshape.Top = 50
Application.CutCopyMode = False
End Sub
Somebody have any idea where i am doing wrong. Thanks
Upvotes: 1
Views: 591
Reputation: 184
I figure it out.
I don't know where the problem occur.
But the solution that work for me is to replce
PPSlide.Shapes.PasteSpecial ppPasteDefault
with
PPApp.ActiveWindow.View.PasteSpecial DataType:=ppPasteDefault
Thanks
Upvotes: 3