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