How do I change by vba the height of an image in Powerpoint WITHOUT changing the width?

Asked

Viewed 27 times

-1

In my code I do so to make the width of my image equal to the slide, but this way changes the height proportionally, and I do not want this.

'Criar Slide 2 

Set ppSlide = Apr.Slides.Add(2, ppLayoutBlank) 

ppSlide.Select

Planilha1.Range("c3").CurrentRegion.CopyPicture

ppSlide.Shapes.Paste

Set ppShape = ppSlide.Shapes(1)

ppShape.Width = Apr.PageSetup.SlideWidth

Does anyone know how to solve this? And if I do below a line of code using . Height, it overrides the measures of the previous, then does not solve either

1 answer

0

Hi, Felipe!

By default the aspect lock is enabled for any object of type Image.

The difficulty is that for geometric shapes is not (which creates confusion), and to make matters worse both are called internally Shapes.

Turns out it doesn’t get very intuitive.

To do what you want, you need to unlock the proportions first

ppShape.LockAspectRatio = msoFalse
ppShape.Width = Apr.PageSetup.SlideWidth

However it is worth remembering that proportion is a serious thing, so as a rule it should never be distorted if the original is correct.

Second situation about proportion, everything can be reduced without losing quality (Audio, Image and Video), but nothing can be increased without losing quality or distort (except PNG Corel vectors and etc)

When in doubt, avoid

Browser other questions tagged

You are not signed in. Login or sign up in order to post.