Copy Range into PowerPoint

tsm1111

New Member
Joined
Sep 26, 2011
Messages
11
I am trying to do something very simple but running into a problem with pasting. I am a VBA novice. Please see the code below. I have the reference to Microsoft PowerPoint Object library set up. Everything works util the paste step.

Sub PowerPoint()
'creates new instance of powerpoint
Dim ppApp As Object
Dim ppPres As PowerPoint.Presentation
Dim ppSlide As PowerPoint.Slide


Set ppApp = CreateObject("PowerPoint.Application")
ppApp.Visible = True
ppApp.Activate


'cretae presentation
Set ppPres = ppApp.Presentations.Add


Set ppSlide = ppPres.Slides.Add(1, ppLayoutTitle)


ppSlide.Shapes(1).TextFrame.TextRange = "Title"
ppSlide.Shapes(2).TextFrame.TextRange = "by First Last"


Set ppSlide = ppPres.Slides.Add(2, ppLayoutBlank)


ppSlide.Select


Range("C3:H8").Copy


ppSlide.Shapes.Paste


End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Your code seems to work for me. Do you get an error? If so, which one?
 
Upvote 0
Shapes (unknown member): invalid request. Clipboard is empty or contains dtat which may not be pasted here. Here is how my table looks like:

ABCDMonthSales
1611One1/1/20157
2712Two2/1/20153
3813Three3/1/20151
4914Four4/1/20156
51015Five5/1/20152



<colgroup><col style="width: 48pt;" span="6" width="64">
<tbody>


</tbody>
 
Upvote 0
Does it help if you copy the range as a picture?

Code:
Range("C3:H8").[COLOR=#ff0000]CopyPicture[/COLOR]
 
Upvote 0
Try...

Code:
Range("C3:H8").Copy
ppSlide.Shapes.PasteSpecial DataType:=ppPasteOLEObject, Link:=msoFalse
 
Upvote 0
Comes back with the same error: Shapes (unknown member): invalid request. Clipboard is empty or contains dtat which may not be pasted here. Here is how my table looks like:
 
Upvote 0
in Office 2010 you have to use

ppSlide.Shapes.PasteSpecial ppPasteOLEObject

!!!!!!!!!!!!!!!!!!
 
Upvote 0
Actually, both your version and mine are equivalent. In your version, since you haven't explicitly set the argument for Link to true or false, it defaults to false.
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,268
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top