Resizing the comments box to fit the embedded image
Posted on 2011-02-15
I have been making a spreadsheet to collect images from a location on the computer and input them as a image in a comments box. Im looking for a way to lock the aspect ratio for the picture within the macro, and have the image be a certain size. This is the code I have been using (which someone on here previous helped me with):
Range("D14").Comment.Visible = True
Range("D14").Comment.Text Text:="" & Chr(10) & ""
Selection.ShapeRange.ScaleWidth 5#, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 6#, msoFalse, msoScaleFromTopLeft
This works fine as long as the image ratio is 4x6, but when someone needs to use a portrait picture, it gets stretched.
Any and all solutions would be fantastic