你好,我是PowerPoint VBA世界中的Newbee,希望我的英语不是太糟糕:我必须在PowerPoint 2010中解决以下问题:首先我改为16:9宽屏格式,然后我经历通过单击向上和向下箭头来缩放高度,对于现在太大的每张图片都会从图片中更改大小对话框。图片将采用我之前在4:3演示文稿中使用的正确形式。这很容易,但如果你不得不改变超过100张图片,那就不行了。我尝试了很多次,但没有任何作用。这是我的代码:
Sub ChangePictures()
Dim sld As Slide
Dim sh As Shape
Dim meinShHeight As Double
ActivePresentation.PageSetup.SlideSize = 15
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
'If sh = msoLinkedOLEObject Or msoTextBox Then
If sh.Type = msoPicture Then
'meinShHeight = sh.ScaleHeight.Value
'sh.ScaleHeight meinShHeight, msoScaleFromTopLeft
sh.LockAspectRatio = msoTrue
With tSlide.Shapes.Select
.Height = ActiveWindow.Presentation.PageSetup.SlideHeight
.Width = ActiveWindow.Presentation.PageSetup.SlideWidth
End With
'sh.ScaleHeight 1.75, msoTrue
'sh.ScaleHeight -1.75, msoTrue
End If
'End If
Next
Next
End Sub
也许在VBA中使用这个向上和向下箭头技巧是不可能的? 不幸的是我不能使用PowerPoint 2013然后我的演示文稿没有任何问题。
有没有人可以帮助我。我希望以正确的方式表达我的问题; - )
提前致谢。
此致 基基
答案 0 :(得分:0)
这对我有用
Sub ChangePictures()
Dim sld As Slide
Dim sh As Shape
ActivePresentation.PageSetup.SlideSize = 15
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
If sh.Type = msoPicture Then
With sh
.LockAspectRatio = msoTrue
.ScaleHeight ActiveWindow.Presentation.PageSetup.SlideHeight, msoTrue
.ScaleWidth ActiveWindow.Presentation.PageSetup.SlideWidth, msoTrue
End With
End If
Next
Next
End Sub