问题描述
||
谁能帮助我解决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
任何建议都是最欢迎的。
解决方法
这适用于从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对象。