Selection not selcted when pasting?

  • Thread starter Thread starter Colleyville Alan
  • Start date Start date
C

Colleyville Alan

I am copying a range from Excel and pasting it to PPT. I want to insert the
info as a picture, so since pre PPT2002 VBA code does not have a way to
emulate the PasteSpecial as Picture, I am using Excel's CopyPicture method
and a straigthforwar Paste in PPT.

Problem - as soon as I paste the image, I want to resize it and set the
spacing. The code I use is:

oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste 'pastes image

With oPPT.ActiveWindow.Selection.ShapeRange
.Height = 620
.Width = 650
.Left = 20
.Top = 80
End With

But I get an error message saying that nothing is selected. I had thought
that upon pasting, I'd still have the image selected just as I do in the
interactive mode. How can I now "select" this image in order to resize it?
Or is there some other way to resize?

Thanks
 
The paste method returns the reference the pasted shape/slide range.

Dim oPastedRange As ShapeRange
Set oPastedRange =
oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste
With oPastedRange
....

End With
or if you want to edit the properties of the 1st shape in the range

With oPastedRange(1)


End With
 
Shyam Pillai said:
The paste method returns the reference the pasted shape/slide range.

Dim oPastedRange As ShapeRange
Set oPastedRange =
oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste
With oPastedRange
....

End With
or if you want to edit the properties of the 1st shape in the range

With oPastedRange(1)


End With

thanks
 
I am copying a range from Excel and pasting it to PPT. I want to insert the
info as a picture, so since pre PPT2002 VBA code does not have a way to
emulate the PasteSpecial as Picture, I am using Excel's CopyPicture method
and a straigthforwar Paste in PPT.

Problem - as soon as I paste the image, I want to resize it and set the
spacing. The code I use is:

oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste 'pastes image

With oPPT.ActiveWindow.Selection.ShapeRange
.Height = 620
.Width = 650
.Left = 20
.Top = 80
End With

But I get an error message saying that nothing is selected. I had thought
that upon pasting, I'd still have the image selected just as I do in the
interactive mode. How can I now "select" this image in order to resize it?
Or is there some other way to resize?

Try:

With oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste
.Height = 620
.Width = 650
.Left = 20
.Top = 80
End With

or

Dim oSh as Shape
set oSh = oPPT.ActivePresentation.Slides(slideindexvar).Shapes.Paste
with oSh
.Height = 620
.Width = 650
.Left = 20
.Top = 80
End With
 
Back
Top