Insert picture using Macro..
I made asmall eror
from
If pict.Height 100 Then
Crop = (CellWidth - pict.Width) / 2
to
If pict.Height 100 Then
Crop = (CellHeight - pict.Height) / 2
" wrote:
On Jun 19, 3:23 am, Joel wrote:
You need to get the height and width of the cell is is going into to center
the cell
CellHeight = range("A1").Height
CellWidth = range("A1").Width
pict.LockAspectRatio = msoTrue
if pict.width pict.height then
pict.width = 100
else
pict.height = 100
end if
WidthBorder = CellWidth - pict.width
pict.left = Range("A1").left + WidthBorder/2
HeightBorder = CellHeight - pict.height
pict.top = Range("A1").Top + HeightBorder/2
" wrote:
On Jun 18, 2:07 pm, wrote:
On Jun 18, 11:20 am, Joel wrote:
You need to get the larger of the width or height variable and adjust it to 100
pict.LockAspectRatio = msoTrue
if pict.width pict.height then
else
pict.height = 100
end if
" wrote:
I have amacrothat I use toinsertpictures in excel but I am having
difficulty with thepicturesize, I would like thepictureto keep the
Aspect Ratio but to have a maximum of 100 height and a maximum 100
width is this possible, any help is appreciated.
Thanks.- Hide quoted text -
- Show quoted text -
Thanks, you are great!.
Is there any way that I can center the pictures in the cell, because
when the width is than the height it ia scaling it to 100 but then
it is being placed slightly on the cell in to the left.
thanks- Hide quoted text -
- Show quoted text -
Hi,
I am wondering if this will work! I tried but it seems that I am doing
something wrong can you help please.
pict.LockAspectRatio = msoTrue
if pict.width pict.height then
pict.cropleft = 50
pict.cropright = 50
else
pict.height = 100
end if- Hide quoted text -
- Show quoted text -
Hi,
Is it possible to Crop the picture from left and right instead of
sizing it "pict.width = 100"
thanks.
|