How to auto size jpeg files into excel when import/insert pictures
You need to read, for example, the width of both the range where you are pasting, and the width of
the jpg:
With ActiveSheet
'Select the cell where the picture is placed
Range("rngForJPG").Cells(1,1).Select
'Insert the picture
.Pictures.Insert(myImageFileName).Select
'scale the picture to the width of the column
myScale = Range("rngForJPG").Cells(1,1).EntireColumn.Width / Selection.ShapeRange.Width
Selection.ShapeRange.ScaleWidth myScale, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight myScale, msoFalse, msoScaleFromTopLeft
'Change the row height to the picture height
Range("rngForJPG").Cells(1,1).EntireRow.RowHeight = Selection.ShapeRange.Height
End With
HTH,
Bernie
MS Excel MVP
"Ken C" wrote in message
...
Is there an add-in that will auto size a picture within a specified area
without having to resize it all the time. I'm trying to design my own
trading journal and need to import screen shots saved as jpeg file into a
specified area. Any help would be greatly appreciated.
|