在powerpoint中调整大小并移动图片

时间:2014-03-13 11:28:39

标签: powerpoint powerpoint-vba

我有以下VBA代码,可以将excel文件粘贴到powerpoint中。我工作,但粘贴后我还想调整它(使它小一点)并将其移动到右上角。

有关如何更改以下代码以实现此目的的任何建议?

亲爱的,

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

1 个答案:

答案 0 :(得分:1)

而不是这一点:

With slide
  .Shapes.Paste
End With

代替:

Set shape = slide.shapes.paste(1)
With shape
   .Left = 100  ' or whatever
   .Width = 500 ' or whatever
End With