Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that I use to insert pictures in excel but I am having
difficulty with the picture size, I would like the picture to 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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 pict.width = 100 else pict.height = 100 end if " wrote: I have a macro that I use to insert pictures in excel but I am having difficulty with the picture size, I would like the picture to 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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 * *pict.width = 100 else * *pict.height = 100 end if " wrote: I have a macro that I use to insert pictures in excel but I am having difficulty with the picture size, I would like the picture to 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 * *pict.width = 100 else * *pict.height = 100 end if " wrote: I have a macro that I use to insert pictures in excel but I am having difficulty with the picture size, I would like the picture to 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 pict.width = 100 else pict.height = 100 end if " wrote: I have a macro that I use to insert pictures in excel but I am having difficulty with the picture size, I would like the picture to 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert picture with macro | Excel Programming | |||
Insert Picture Macro. | Excel Programming | |||
Insert Picture Name Assignment in Macro | Excel Programming | |||
Insert Picture Macro | Excel Programming | |||
INSERT PICTURE IN MACRO | Excel Programming |