1

我正在尝试使用 powerpoint vba 调整我从 Excel 粘贴到 powerpoint 中的图片的大小。

我的代码说:

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

这部分工作正常,我不知道如何在下一步中调整图片大小。我是使用 powerpoint vba 的新手。

任何帮助将非常感激。

4

1 回答 1

5
  • 除非绝对必须,否则永远不要选择任何东西,而且你很少必须.. 获取对形状的引用。

  • 您实际上不需要查看幻灯片来操作该幻灯片上的形状

  • 使用形状的 .Top、.Left、.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
于 2012-11-01T14:00:00.903 回答