Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-27-2017, 04:39 AM
jamesupshaw jamesupshaw is offline How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Windows 10 How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Office 2016
Novice
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once?
 
Join Date: Apr 2017
Posts: 2
jamesupshaw is on a distinguished road
Default How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once?

Hi all. I'm making an awesome game for my students but need some help setting up my slides so they can see all the pictures.



My problem is that PowerPoint 2016 defaults all pictures inserted in picture placeholders to "crop to fill" so it cuts off too much of most of the pictures. But for this game to work, I need every picture to fit in each picture placeholder (crop to fit).

Can anyone help me make a macro that crops-to-fit all pictures at once? And all of the pictures will be in picture placeholders.

(Every game I make has over 60 slides and about 10 pictures per slide, so that's a lot of manual clicking I've tried regular content placeholders. They won't work for the game because they only insert pictures vertically, but in the game I need to rotate all the pictures different angles)
Reply With Quote
  #2  
Old 04-27-2017, 07:23 AM
JohnWilson JohnWilson is offline How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Windows 7 64bit How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,855
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

Not sure why you think content placeholders cannot be rotated.

There is nothing in the Object Model to set the crop type but it is possible by calling executeMso (essentially having code click the button)

Try this

Code:
Sub fixCrop()
   Dim osld As Slide
   Dim oshp As Shape
   For Each osld In ActivePresentation.Slides
      For Each oshp In osld.Shapes
         If oshp.Type = msoPlaceholder Then
            If oshp.PlaceholderFormat.Type = ppPlaceholderPicture Then
               ActiveWindow.View.GotoSlide (osld.SlideIndex)
               oshp.Select
               CommandBars.ExecuteMso ("PictureFitCrop")
            End If
         End If
      Next
   Next
End Sub
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 04-27-2017, 08:15 AM
jamesupshaw jamesupshaw is offline How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Windows 10 How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Office 2016
Novice
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once?
 
Join Date: Apr 2017
Posts: 2
jamesupshaw is on a distinguished road
Default The code works well! My hands are saved... now my students hands will fall off from these games

Thanks a million for the macro. It works like a charm.
You just added hours...no, actually days onto my life.

And apologies about the content placeholder confusion. I definitely can rotate the content placeholder in the slide master. The only problem is that when you insert a picture into a regular content placeholder that's been rotated, it always puts the picture up and down. It doesn't rotate it with the placeholder for some odd reason.

That's not the case with the picture placeholder. The pic keeps the orientation of the placeholder. And now with your nifty macro, all my pictures can be rotated and cropped to fit.

Truly grateful
Reply With Quote
  #4  
Old 04-28-2017, 09:35 AM
JohnWilson JohnWilson is offline How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Windows 7 64bit How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,855
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

Glad it helped. Still don't understand the rotation problem with content placeholders though!
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply

Tags
crop to fit, placeholders, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Using "insert other placeholders" *Ask, *Fill In, etc nfotx Mail Merge 1 07-06-2015 02:04 PM
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? "Insert Picture\Link to File..." embeds picture sinz54 Drawing and Graphics 1 09-29-2013 06:31 PM
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? how to make the "Picture Tools" ribbon permanent? skipstocks Word 1 07-19-2013 06:51 AM
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? "format picture" - arrows show as no line atop picture marbeth Word 3 07-08-2011 02:16 PM
How can I make VBA to "crop to fit" all pictures to picture placeholders across all slides at once? Option "Show picture placeholders" only works for inline pictures?? Fix? MattM Word 2 06-15-2011 06:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft