私はパワーポイントでVBで作業しており、現在編集中のスライドでのみ画像のサイズを変更して中央に配置する簡単なマクロを作成しようとしています。画像のサイズ変更と中央揃えを行うコードを正常に作成しましたが、現在別のスライドを表示および編集している場合でも、プレゼンテーションの最初のスライドでしか機能しません。表示中のスライドにコードを適用するにはどうすればよいですか?
コードは次のとおりです。
Dim shp As Shape
Dim sld as Slide
Dim x As Integer
Dim y As Integer
With ActivePresentation.PageSetup
x = .SlideWidth / 2
y = .SlideHeight / 2
End With
For Each sld In ActiveWindow.Selection.SlideRange
For Each shp In sld.Shapes
If shp.Type = msoPicture Then
shp.Height = y * 2
shp.Width = x * 2
shp.Left = x - (shp.Width / 2)
shp.Top = y - (shp.Height / 2)
End If
Next
Next
End Sub
どうもありがとうございました!