Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From Excel to PowerPoint. Copy a range into the image box.

Status
Not open for further replies.

vladk

Programmer
May 1, 2001
991
US
Hi,

I try to do the following one, using VBA:

1. Insert object (select Bitmap Image) into Powerpoint slide

2. Copy range in Excel workbook.

3. Paste this range INTO the bitmap image object in PowerPoint.


So far, I was able to add an empty image to a slide and activate it to prepare for accepting the paste:

Code:
Set objSlide = gobjPresentation.Slides(1)
        
objSlide.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, ClassName:="Paint.Picture", Link:=msoFalse).OLEFormat.Activate

However, I could find only this way of pasting:

Code:
objSlide.Shapes.Paste

It pastes the range onto slide surface, when I need it in the bitmap object. I can do it manually, but cannot reproduce programmatically.

Can anybody help me with this?

Thank you!

Vlad



 



Hi,

Try this (untested)
Code:
Set objSlide = gobjPresentation.Slides(1)
        
with objSlide.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, ClassName:="Paint.Picture", Link:=msoFalse)
  .paste
end with

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Hi Skip,

It says "Compile error. Method or data member not found", It's OK, I found this way (not very nice, but it works):
Code:
    SendKeys "+{INSERT}", True
    SendKeys "{ESCAPE}", True
    SendKeys "{ESCAPE}", True

Skip, thank you for the response!

Vlad
 
What about pasting bitmap into shape instead of paint object?
Code:
Dim objShape As ShapeRange 'early binding assumed
Set objShape = objSlide.Shapes.PasteSpecial(ppPasteBitmap)

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top