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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the size of shape after paste

Status
Not open for further replies.

marijonas

Technical User
Apr 20, 2004
29
SE
Hi I am trying to write a macro that pastes charts as pictures into an existing powerpoint presentation.
I succeeded in making it paste but I also want to change the size of picture after that. There are other objects on the same slide of powerpoint and I wonder if there is a possibility to get the name of the last created shape and then apply the size changes.

Here is the peace of what I have so far:


Set xlWrkBook = xlApp.Workbooks.Open("....xls")
ppApp.Presentations.Open (".....ppt")

xlWrkBook.Sheets("SheetName").ChartArea.Copy
ppApp.ActivePresentation.Slides(slideNumber).Shapes.PasteSpecial DataType:=ppPasteMetafilePicture, Link:=False, DisplayAsIcon:=False


I would really be greatful for all kind of help.
 
The Shapes collection should have a Count property helping you referencing the last Shape.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks... I actually succeded in finding a way... here it is if someone else would like to do it

xlWrkBook.Sheets("SheetName").ChartArea.Copy
With ppApp.ActivePresentation.Slides(10).Shapes
With .PasteSpecial(DataType:=ppPasteMetafilePicture, Link:=False, DisplayAsIcon:=False)
.Height = 370
'.Width = 50.75
.Left = 30
.Top = 120
.Name = "Diagram"

End With
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top