2012-11-01 287 views
2

我正在嘗試調整使用powerpoint vba從Excel中粘貼到powerpoint圖片的大小。使用Powerpoint vba調整圖片尺寸

我的代碼表示:

ActivePresentation.Slides(9).Select Application.ActiveWindow.View.PasteSpecial DataType:=ppPasteEnhancedMetafile

這部分工作得很好,我很茫然,如何再調整圖片大小在下一步。我是使用powerpoint vba的新手。

任何幫助將不勝感激。

回答

4
  • 切勿選擇任何東西,除非你絕對必須的,你很少必須..獲取對形狀的參考來代替。

  • 你實際上並不需要進行觀看幻燈片操縱形狀上滑

  • 使用形狀的.TOP,。左,.Height和.WIDTH屬性來設置其位置和大小

實施例:

Dim oSh As Shape 

Set oSh = ActivePresentation.Slides(9).Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1) 
' .PasteSpecial returns a ShapeRange; the (1) at the end of the line above 
' returns the first shape in the range. W/o that, you get a type mismatch error 
' from trying to assign a range to a shape 

With oSh 
    ' Set position: 
    .Left = 0 
    .Top = 0 
    ' Set size: 
    .Height = 100 
    .Width = 200 
End With