2014-03-13 38 views
0

我有以下的VBA代碼,讓我粘貼一個excel文件到一個簡報。我工作,但粘貼後,我也想調整它的大小(使它變小一點),並將其移動到右上角。大小和移動一張照片在powerpoint

有關如何更改下面的代碼來完成此任務的任何建議?

尊敬的問候,

馬克

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

代替此位:

With slide 
    .Shapes.Paste 
End With 

替補這樣的:

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