I use the following macro. It was written to accomodate a banner containing
title etc but can readily be modified to exclude that. It makes the
background black and resizes the image to full width or full height without
cropping. Hope this helps.
Option Explicit
Sub FitToSlide()
' Copyright Christopher T. Watts (20009)
Dim sTopLimit As Long
Dim sMaxHeight As Single
Dim sMaxWidth As Single
Dim sSlideRatio As Single
Dim sObjectRatio As Single
Dim Cm2Pt As Single
Cm2Pt = 28.3464566929
sTopLimit = 2.3 * Cm2Pt
sMaxHeight = 16.75 * Cm2Pt
sMaxWidth = 25.4 * Cm2Pt
sSlideRatio = sMaxWidth / sMaxHeight
With ActiveWindow.Selection.ShapeRange(1)
sObjectRatio = .Width / .Height
..LockAspectRatio = msoTrue
If sObjectRatio > sSlideRatio Then
' Maximise the width
.Width = sMaxWidth
' Position vertically midway between banner and bottom
' ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
' .Top = .Top + sTopLimit / 2
' Alternatively position at sTopLimit
.Top = sTopLimit
Else
' Maximise height
.Height = sMaxHeight
.Top = sTopLimit
End If
End With
' Centre horizontally on slide
ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
' Set background to Black
With ActiveWindow.Selection.SlideRange(1)
.FollowMasterBackground = msoFalse
With .Background
.Fill.Visible = True
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
End With
End With
End Sub
cheers
Chris