Hi,
I have some code which takes a range in excel (which changes in size) and then pastes it into powerpoint as a picture. I need some code that will copy the range and paste it as a picture to a specified width or height (one or the other). Whether the picture is sized to the specified width or height is based on its aspect ratio (which must be maintained). Put another way - if one corner of the picture was dragged out to enlarge it, when it reaches the specified height or width (whichever comes first) it stops. Effectively I’m making sure the picture always fills the required space on the PPT slide as best it can.
The specified sizes are:
Height: 438
Width: 705
Hope this makes sense, the section of code I need changing is below.
Any help with this would be much appreciated.
I have some code which takes a range in excel (which changes in size) and then pastes it into powerpoint as a picture. I need some code that will copy the range and paste it as a picture to a specified width or height (one or the other). Whether the picture is sized to the specified width or height is based on its aspect ratio (which must be maintained). Put another way - if one corner of the picture was dragged out to enlarge it, when it reaches the specified height or width (whichever comes first) it stops. Effectively I’m making sure the picture always fills the required space on the PPT slide as best it can.
The specified sizes are:
Height: 438
Width: 705
Hope this makes sense, the section of code I need changing is below.
Any help with this would be much appreciated.
Code:
With Shp
.LockAspectRatio = msoTrue
.Width = 705
sngDefaultSlideWidth = PPPres.PageSetup.SlideWidth
sngDefaultSlideHeight = PPPres.PageSetup.SlideHeight
.Left = (sngDefaultSlideWidth - .Width) / 2
.Top = (sngDefaultSlideHeight - .Height) / 2
.ZOrder msoSendToBack
End With