Insert Picture and resize

  • Thread starter Thread starter David H
  • Start date Start date
D

David H

Hi

I am a bit of a newbie when it comes to VBA programming, but I try.

I am trying to find a way to resize a JPG picture when I insert on to a
cell. I have created an XL sheet with some VB to insert a whole lot of
pictures down a column, to fix on a temporary basis I resized all my
pictures. But in the future that may be difficult to do.

So what I want to do is work out the size "x" & "y" and then somehow scale
the picture down to a standard size. I have the inserting and moving down
the sheet worked out.

Thanks for reading and even more thanks if you can help

Regards David
 
Turn on the macro recorder,
Right click on the picture and select format picture, then go to the size
tab.

Size you picture

Turn off the macro recorder.

This should give you some of the attributes you can play with.
 
Thank's for the help

This is what I used, the last three lines do the resize.

Range(picloc).Select
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(picturefilename) Then
Selection.Delete
ActiveSheet.Pictures.Insert(picturefilename).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 40
Selection.ShapeRange.Rotation = 0#

Regards David
 
Back
Top