在PPT 2007中裁剪图像(增强型图元文件)

时间:2011-05-31 08:53:49

标签: image-processing crop powerpoint-vba

任何人都可以帮助我解决PPT 2007中的问题。

我在幻灯片中有一张图片(来自excel的图表粘贴为“图片(增强型图元文件)”)。我只需裁剪此图像以适应幻灯片。我尝试了以下代码,但无济于事:

“1:

使用ActivePresentation.Slides(1).Shapes(1)

    .PictureFormat.CropLeft = 10

    .PictureFormat.CropTop = 10

    .PictureFormat.CropRight = 10

    .PictureFormat.CropBottom = 10

End With

'Runtime error "ActiveX Component can't create object

“2:

ActiveWindow.Selection.ShapeRange.PictureFormat.CropRight = 10

ActiveWindow.Selection.ShapeRange.PictureFormat.CropLeft = 10

ActiveWindow.Selection.ShapeRange.PictureFormat.CropBottom = 10

ActiveWindow.Selection.ShapeRange.PictureFormat.CropTop = 10

'Object doesnt support this property or method

欢迎提出任何建议。

1 个答案:

答案 0 :(得分:0)

这适用于从Excel粘贴的EMF:

  Dim oSh as Shape
  Set oSh = ActiveWindow.Selection.ShapeRange(1)
  ' Note:  ShapeRange(1), not just ShapeRange
  '  That's the problem with your second example

  With oSh
     .CropLeft = 10
     ' etc
  End With

第一个例子中有关于activex对象大喊大叫的事实让我想知道第一个形状是否真的是一个EMF,它不是一个ActiveX对象。