Consulting

Results 1 to 2 of 2

Thread: Can't paste in an Excel object?

  1. #1

    Can't paste in an Excel object?

    I'm trying to paste something in an Excel Object placed in a Powerpoint presentation.

    The first line, which activates the edit mode for the object works fine, but I can't seem to paste, it gives me an error saying "This object does not support this method or property".

    ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat.DoVerb 1
            ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat.Object.Worksheets("data").Range("c4").Paste
    Any ideas?

  2. #2
    VBAX Newbie
    Joined
    Apr 2007
    Posts
    2
    Location
    Quote Originally Posted by afx
    I'm trying to paste something in an Excel Object placed in a Powerpoint presentation.

    The first line, which activates the edit mode for the object works fine, but I can't seem to paste, it gives me an error saying "This object does not support this method or property".

    ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat.DoVerb 1
            ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat.Object.Worksheets("data").Range("c4").Paste
    Any ideas?
    Try this. It's created fairly quickly and is untested but I think
    it should do the trick.

    Maybe some of the Excel gurus in this forum has an even smoother solution...

    Sub PasteToObject()
    Dim oleObject As Object
        Dim objApp As Object
        Dim wks As Object
        Dim rng As Object
    '   Activate the ole object.
        ActivePresentation.Slides(1).Shapes("Object 10").OLEFormat.DoVerb 1
    '   Get a reference to the ole object.
        Set oleObject = ActivePresentation.Slides(1).Shapes("Object 10").OLEFormat.Object
        '   Get a reference to the ole object's application
        '   in this case Excel
        Set objApp = oleObject.Application
        '   Get a reference to the worksheet
        Set wks = objApp.Worksheets("data")
        '   Set the specified range and select the range
        Set rng = wks.Range("c4")
        '   Select the range
        rng.Select
        '   Execute the paste method from worksheet object
        wks.Paste
    Set objApp = Nothing
    End Sub
    Last edited by Aussiebear; 04-28-2023 at 01:13 AM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •