Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrinking a screen shot to fit in PowerPoint

Status
Not open for further replies.

N2Life

Programmer
Dec 21, 2002
90
US
Was browsing this forum this morning and came across thread68-1302164, which is now closed. I had also been looking for a way to automatically shrink-to-fit PrintScreen shots that I put into Powerpoint. Could not locate any built-in feature to do that, so wrote VBA code to take care of it:

Sub ShrinkToFitScreen()
' Capture a screen shot (PrintScreen or Alt-PrintScreen).
' Paste onto an empty slide.
' Select the image by clicking on it. (Important!)
' Run this macro. (Alt Tools Macro Macro <enter>)
With ActiveWindow.Selection.ShapeRange
.LockAspectRatio = msoFalse
.Left = 0#
.Top = 0#
.Height = 540#
.Width = 720#
End With
ActiveWindow.Selection.Unselect
End Sub

This actually sizes to fit, so if your shot is smaller than the available space, it will be stretched to fill it.
 
Hi,

Your code will not work correctly if your page setup is anything but the default size.

I only post this code here, because of your original post. VBA code ought to be posted in Forum707 or in a FAQ in this forum.

This does not only apply to screen shots, but ANY shape.

This does not necessarily SHRINK the selected object; it sizes it and positions it to fit the current slide size.
Code:
Sub FitShapeToScreen()
' Select a shape by clicking on it. (Important!)
' Run this macro. (Alt Tools Macro Macro <enter>)
    With ActiveWindow.Selection.ShapeRange
        .LockAspectRatio = msoFalse
        .Left = 0#
        .Top = 0#
        .Height = ActivePresentation.PageSetup.SlideHeight
        .Width = ActivePresentation.PageSetup.SlideWidth
    End With
    ActiveWindow.Selection.Unselect
End Sub

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top