开发者

Cropping an image in Powerpoint using VBA

开发者 https://www.devze.com 2022-12-10 11:44 出处:网络
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.开发者_JAVA技巧

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.

开发者_JAVA技巧

Can anyone offer any advice?


The following commands will crop 10 points off of each edge of the shape:

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:

With ActiveWindow.Selection.ShapeRange(1)

See additional information on the CropBottom/etc. properties here: https://learn.microsoft.com/en-us/office/vba/api/powerpoint.pictureformat.cropbottom

0

精彩评论

暂无评论...
验证码 换一张
取 消