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?
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.
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.
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
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...
Re: Can't paste in an Excel object?
I never use paste. You can assign even if multiple cells:
vb Code:
With ActivePresentation.Slides(1).Shapes("Object 4").OLEFormat.Object.Worksheets("Sheet1")
' 'single cell - .Value optional
.Range("C1") = .Range("A6")
' 'multiple cells - need .Value
.Range("C3:D14") = .Range("A3:B14").Value
End With
:D
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:
With ActivePresentation.Slides(1).Shapes("Object 4").OLEFormat.Object.Worksheets("Sheet1")
' 'single cell - .Value optional
.Range("C1") = .Range("A6")
' 'multiple cells - need .Value
.Range("C3:D14") = .Range("A3:B14").Value
End With
:D
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.