Quote Originally Posted by rlv View Post
You appear to be mixing early binding and late binding for powerpoint in the same sub. Why? Usually, only one approach is chosen.



From the perspective of someone taking the time to help you, they are not all that unimportant, since it means a lot of typing and/or guessing about that missing information if the problem is to be replicated.

My guess is that the problem is coming because you are trying to paste to the window instead of to the slide. Here's a potential alternative.
 Sub Test()

    Set PowerPointApp = CreateObject("PowerPoint.Application")
    PowerPointApp.Visible = True
    DestinationPPT = "C:\Users\Saeed\Desktop\edit vba\test.pptx"
    Set ppPres = PowerPointApp.Presentations.Open(DestinationPPT)
    Sheets("Slide3").Range("A2").Copy
    With ppPres.Slides(3)
        .Shapes.Paste
        Set shp = .Shapes(.Shapes.Count)
        shp.Left = 17
        shp.Top = 90
    End With
    ppPres.SaveAs "C:\Users\Saeed\Desktop\edit vba" & Filename, ppSaveAsPDF
    ppPres.Close
    PowerPointApp.Quit
    Set ppt = Nothing
Tnx for your response.
You are right about early and late binding. Its somehow a messy job but it works.
I had used the pppres.slide(3).shapes.paste method before and the same error happened. Surprisingly I found out this error is somehow related to memory space (Ram) of my system and whenever I close the background programs it works much better !!
Any way I wanted to know if I can use a "on Error goto label" or not ???
somthing like :
On error GoTo X
X:
Sheets("Slide3").Range("A2").Copy
    With ppPres.Slides(3)
        .Shapes.Paste
        Set shp = .Shapes(.Shapes.Count)
        shp.Left = 17
        shp.Top = 90
    End With
But it seems I dont know exacltly how to use this method so that I can repeat the procedure until I succeed.
It would be appreciated if you could help me use the On Error GoTO .... part