none
Excel VBA Error Invalid Request RRS feed

  • Question

  • Hi,

    I want to copy a file from Excel and paste it in a PowerPoint slide as a picture.

    The code:

        ThisWorkbook.Worksheets(1).ChartObjects("Graph 1").Copy
        newPowerPoint.ActivePresentation.Slides(3).Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select
        
        Set ShapePP = newPowerPoint.ActivePresentation.Slides(2).Shapes(newPowerPoint.ActivePresentation.Slides(3).Shapes.Count)
        
        With ShapePP
        
            .Top = 256
            .Left = 0
            .Width = 500
            .Height = 196
        
        End With


    When I use this, I get the following error

    ShapeRange (unkown member): Invalid request. To select a shape, its view must be active.

    Does any one know what's wrong and more important: how to solve this?

    Thanks!

    Thursday, November 3, 2016 3:12 PM

Answers

  • Hi,

    To fix the issue, you could add a line to select the slide.

    newPowerPoint.ActivePresentation.Slides(3).Select

    newPowerPoint.ActivePresentation.Slides(3).Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by ganeshgebhard Friday, November 4, 2016 8:42 AM
    Friday, November 4, 2016 8:31 AM
    Moderator