copying to powerpoint...error message

J

Jay

I execute the following code and the error message "View.Paste: Invalid
request. Clipboard is empty or contains data which may not be pasted here."

Can anyone figure out why this is happening? Thanks. Here's my code, just
assume the variable rngPicture is a range of cells in Excel.

Dim P As Object
Dim SI As Long
Dim S As Object

Set P = app.Presentations.Open(Filename:=strFile, ReadOnly:=msoFalse)
'copy the first slide in the powerpoint presentation
SI = P.Slides(1).Duplicate.SlideIndex
'set the slide object S equal to the newly added slide
Set S = P.Slides(SI)
S.Select
rng.CopyPicture
S.Application.ActiveWindow.View.Paste
 
B

Barb Reinhardt

Try something like this
Dim S as Slide

S.Shapes.Paste.Select

I have this in my code, but I'm guessing I don't need the Select
 
B

Barb Reinhardt

Oops.

Dim S as PowerPoint.Slide

You'll need to select PowerPoint in your references as well so that this
will work.
 
J

Jay

Barb, thanks I'll try that; however, in a recent post I asked a question
about why my PowerPoint wasn't working on someone else's PC and the work
around was to use "late binding" where I declare the variables as
objects...this worked and the code was able to function on the other's PC.
I'll at least give this a shot.

Thanks.
 
J

Jay

Barb,

This worked, even keeping the powerpoint objects defined as generic objects.
The difference was in using Shapes.Paste instead of View.Paste...I think
this is much better. Thanks again.

Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top