Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Insert picture using Macro..

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert picture using Macro..

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Insert picture using Macro..

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Insert picture using Macro..

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert picture using Macro..

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Insert picture using Macro..

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert picture with macro Esrei Excel Programming 2 August 21st 07 02:20 PM
Insert Picture Macro. scottybalotty Excel Programming 0 February 15th 06 10:05 PM
Insert Picture Name Assignment in Macro Frankenroc Excel Programming 6 January 19th 06 06:15 PM
Insert Picture Macro SamDev Excel Programming 5 September 9th 05 07:09 PM
INSERT PICTURE IN MACRO Glenn Excel Programming 1 April 23rd 05 11:49 PM


All times are GMT +1. The time now is 11:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"