powerpoint中批量裁剪图片的代码

时间:2015-09-29 14:21:24

标签: vba powerpoint-vba powerpoint-2013

我写了一个宏来批量裁剪并调整所选幻灯片中的图片大小,调整大小工作正常,但是在我添加裁剪代码后,它无法正常工作。请看下面的代码,有什么不对吗?欢迎和感谢的建议。

Sub crpicture ()
Dim osld As Slide
Dim oshp As Shape

For Each osld In ActiveWindow.Selection.SlideRange
For Each oshp In osld.Shapes

 oshp.PictureFormat.CropLeft = 0
 oshp.PictureFormat.CropTop = 0.5 * 72
 oshp.PictureFormat.CropRight = oshp.Width - oshp.Height
 oshp.PictureFormat.CropBottom = 0

 oshp.Height = 3 * 72
 oshp.Left = 3.4 * 72
 oshp.Top = 0.7 * 72
 oshp.ZOrder msoSendToBack

      Next
 Next
 End Sub

0 个答案:

没有答案