Results 1 to 7 of 7

Thread: Can't paste in an Excel object?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    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".

    Code:
    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
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: Can't paste in an Excel object?

    Open an instance of the actual Excel file...

    Dim M_Excel as Object
    Dim Wb as Object

    Set M_Excel = CreatObject("Excel.Application",)
    Set Wb = M_Excel.WEorkbooks.Open("YourFile.xls")

    And alter whatever you want....
    The alturations should be reflected in the presentation on saving the fgile again.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Re: Can't paste in an Excel object?

    Quote Originally Posted by Dnereb
    Open an instance of the actual Excel file...

    Dim M_Excel as Object
    Dim Wb as Object

    Set M_Excel = CreatObject("Excel.Application",)
    Set Wb = M_Excel.WEorkbooks.Open("YourFile.xls")

    And alter whatever you want....
    The alturations should be reflected in the presentation on saving the fgile again.
    It's not an actual excel file, it's just an excel chart object.

  4. #4
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Can't paste in an Excel object?

    Don't paste, just assign the value you want:

    Code:
    With ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat
       .DoVerb 1
       .Object.Worksheets("data").Range("c4") = whatever
    End With

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Re: Can't paste in an Excel object?

    Quote Originally Posted by VBAhack
    Don't paste, just assign the value you want:

    Code:
    With ActivePresentation.Slides(4).Shapes("Object 10").OLEFormat
       .DoVerb 1
       .Object.Worksheets("data").Range("c4") = whatever
    End With
    What if I need to paste? How can I do it?

    Further down the code I have to copy this Range("A5:G14") and to do it all one by one would take a lot of time...
    Last edited by matomato; Jun 6th, 2007 at 12:34 PM.

  6. #6
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Can't paste in an Excel object?

    I never use paste. You can assign even if multiple cells:

    vb Code:
    1. With ActivePresentation.Slides(1).Shapes("Object 4").OLEFormat.Object.Worksheets("Sheet1")
    2. '        'single cell - .Value optional
    3.         .Range("C1") = .Range("A6")
    4. '        'multiple cells - need .Value
    5.         .Range("C3:D14") = .Range("A3:B14").Value
    6.     End With
    Last edited by VBAhack; Jun 6th, 2007 at 01:03 PM.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    19

    Re: Can't paste in an Excel object?

    Quote Originally Posted by VBAhack
    I never use paste. You can assign even if multiple cells:

    vb Code:
    1. With ActivePresentation.Slides(1).Shapes("Object 4").OLEFormat.Object.Worksheets("Sheet1")
    2. '        'single cell - .Value optional
    3.         .Range("C1") = .Range("A6")
    4. '        'multiple cells - need .Value
    5.         .Range("C3:D14") = .Range("A3:B14").Value
    6.     End With
    Thanks, I didn't know you could do that.

    I tried your first solution since it's easier for me because I don't want to check every destination for the complete range.

Posting Permissions

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



Click Here to Expand Forum to Full Width