ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying to powerpoint...error message (https://www.excelbanter.com/excel-programming/416006-copying-powerpoint-error-message.html)

Jay

copying to powerpoint...error message
 
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

Barb Reinhardt

copying to powerpoint...error message
 
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
--
HTH,
Barb Reinhardt



"Jay" wrote:

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


Barb Reinhardt

copying to powerpoint...error message
 
And change This
Dim P as PowerPoint.Presentation
--
HTH,
Barb Reinhardt



"Jay" wrote:

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


Barb Reinhardt

copying to powerpoint...error message
 
Oops.

Dim S as PowerPoint.Slide

You'll need to select PowerPoint in your references as well so that this
will work.
--
HTH,
Barb Reinhardt



"Jay" wrote:

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


Jay

copying to powerpoint...error message
 
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.

"Barb Reinhardt" wrote:

And change This
Dim P as PowerPoint.Presentation
--
HTH,
Barb Reinhardt



"Jay" wrote:

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


Jay

copying to powerpoint...error message
 
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

"Barb Reinhardt" wrote:

And change This
Dim P as PowerPoint.Presentation
--
HTH,
Barb Reinhardt



"Jay" wrote:

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



All times are GMT +1. The time now is 04:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com