Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resizing a Picture
Hello,
Could some one please help me with the following? I need a macro that when a user selects a picture on my spreadsheet (named "items") then the macro will automatically format the selected picture with the following format picture criteria: Height = 10.11cm Width = 14.92cm Height = 253% Width = 249% lock aspect ratio = true relative to original picture size = true Original size = 4cm Height x 6cm Width Any help would be greatly appreciated. Thanks, Chris. Live Long and Prosper :-) *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resizing a Picture
start the macro recorder
select a picture & resize it the way you want it. end the macro recorder see what you've got! (hint - remove the "selection" part, so it will work with whatever picture is selected). :) susan On Mar 28, 7:24 am, Longbow wrote: Hello, Could some one please help me with the following? I need a macro that when a user selects a picture on my spreadsheet (named "items") then the macro will automatically format the selected picture with the following format picture criteria: Height = 10.11cm Width = 14.92cm Height = 253% Width = 249% lock aspect ratio = true relative to original picture size = true Original size = 4cm Height x 6cm Width Any help would be greatly appreciated. Thanks, Chris. Live Long and Prosper :-) *** Sent via Developersdexhttp://www.developersdex.com*** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resizing a Picture
Hi Susan,
Thanks for your reply. I ran the following macro and received a run-time error stating that the item with the specified name could not be found. Sub Macro3() ' ' Macro3 Macro ' Macro recorded 28/03/2007 by User ' ' ActiveSheet.Shapes("Picture 21").Select Selection.ShapeRange.ScaleWidth 2.48, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 2.48, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 1.02, msoFalse, msoScaleFromTopLeft End Sub The first line of my macro code will not run according to the VBE that highlights it in yellow after I debug the run-time error. Could you please advise on how I can get around this problem. Many thanks, Chris. Live Long and Prosper :-) *** Sent via Developersdex http://www.developersdex.com *** |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resizing a Picture
good! yes, as to the problem you're having, remove this statement:
ActiveSheet.Shapes("Picture 21").Select every time you add a shape or a picture, excel gives it a different #. it's hard to keep track of them, because if you delete, say, picture15, the next one inserted will not be another picture15, but will be picture22 (or whatever # comes after the last one you inserted). if you take that line out, you can select a picture, any picture, and run the macro, & it will reshape that one picture. so if you add this macro to a toolbar button, you can select the picture, and push the button, & it will reshape it. hope this helps! susan On Mar 28, 8:34 am, Longbow wrote: Hi Susan, Thanks for your reply. I ran the following macro and received a run-time error stating that the item with the specified name could not be found. Sub Macro3() ' ' Macro3 Macro ' Macro recorded 28/03/2007 by User ' ' ActiveSheet.Shapes("Picture 21").Select Selection.ShapeRange.ScaleWidth 2.48, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 2.48, msoFalse, msoScaleFromTopLeft Selection.ShapeRange.ScaleHeight 1.02, msoFalse, msoScaleFromTopLeft End Sub The first line of my macro code will not run according to the VBE that highlights it in yellow after I debug the run-time error. Could you please advise on how I can get around this problem. Many thanks, Chris. Live Long and Prosper :-) *** Sent via Developersdexhttp://www.developersdex.com*** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Resizing a Picture
Thanks again Susan - your help was terrific and much appreciated.
Cheers, Chris. Live Long and Prosper :-) *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
resizing a picture to fit a single cell HELP | Excel Discussion (Misc queries) | |||
How do i insert a picture in merged cels, with autom. resizing ? | Excel Programming | |||
How to stop Excel2002 auto resizing picture in header from templat | Setting up and Configuration of Excel | |||
Resizing Picture | Excel Programming | |||
Picture resizing | Excel Programming |