使用 VBA 在 Powerpoint 中裁剪图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1660428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cropping an image in Powerpoint using VBA
提问by Paul Ellery
I need to crop an image on a Powerpoint slide using VBA - in my particular case I'm cropping from the top and left edges.
我需要使用 VBA 在 Powerpoint 幻灯片上裁剪图像 - 在我的特殊情况下,我从顶部和左侧边缘裁剪。
Can anyone offer any advice?
任何人都可以提供任何建议吗?
回答by Paul Ellery
The following commands will crop 10 points off of each edge of the shape:
以下命令将从形状的每个边缘裁剪 10 个点:
With ActivePresentation.Slides(1).Shapes(1)
.PictureFormat.CropLeft = 10
.PictureFormat.CropTop = 10
.PictureFormat.CropRight = 10
.PictureFormat.CropBottom = 10
End With
Note that this will crop shape number 1 on slide 1. If you want to crop the currently selected shape, use the following as the first line instead:
请注意,这将裁剪幻灯片 1 上的第 1 个形状。如果要裁剪当前选定的形状,请使用以下内容作为第一行:
With ActiveWindow.Selection.ShapeRange(1)
See additional information on the CropBottom/etc. properties here: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.pictureformat.cropbottom
请参阅有关 CropBottom/等的其他信息。这里的属性:https: //docs.microsoft.com/en-us/office/vba/api/powerpoint.pictureformat.cropbottom