Scale a picture in VBA
excel, excel-2010, vba
Solution
Include this line:
.ShapeRange.LockAspectRatio = msoFalse
To allow both width and height being "unlocked", put it right on the top.
With Selection
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.ScaleWidth 1.4, msoTrue
.ShapeRange.ScaleHeight 0.5, msoFalse
End With
Problem
Currently I am trying to scale a picture in VBA, but cannot seem to get what I need. Every time I run though.... ``` ActiveSheet.Pictures.Insert("C:\\\Logo.bmp").Select With Selection .ShapeRange.ScaleWidth 1.4, msoTrue .ShapeRange.ScaleHeight 0.5, msoFalse End With ``` It will scale to the correct width initially, but then when I go to the next line and try to scale the height it changes the width. Can someone help me understand why this happens and suggest a better way of scaling the picture. I need it to be about 125% bigger in length and about 50% smaller in height. Thanks so much.