Question

I have the following VBA code which let me paste an excel file into a powerpoint. I works, but after a paste it I would also like to size it (make it a little smaller) and move it to the right upper corner.

Any suggestions on how I should change code below to accomplish this?

Dear regards,

Marc

 Sub OpenPPT()


Dim pptapp As PowerPoint.Application
Dim ppt As PowerPoint.Presentation
Dim slide As PowerPoint.slide
Dim shape As PowerPoint.shape

var2 = "C:\Documents and Settings\aa471714\Desktop\Presentation1.ppt"

Set pptapp = CreateObject("Powerpoint.Application")
Set ppt = pptapp.Presentations.Open(var2)
Set slide = ppt.Slides(1)
Set shape = slide.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 100, 100)

pptapp.Visible = True

With slide

.Shapes.Paste

End With

End Sub
Was it helpful?

Solution

Instead of this bit:

With slide
  .Shapes.Paste
End With

Substitute this:

Set shape = slide.shapes.paste(1)
With shape
   .Left = 100  ' or whatever
   .Width = 500 ' or whatever
End With
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top