Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
How do I specify the position of a picture on a worksheet with a macro
? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
with Shapes("Picture 1")
.Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
You can loop like this
Example to delete all pictures Sub test() Dim myshape As Shape For Each myshape In ActiveSheet.Shapes If myshape.Type = msoPicture Then myshape.Delete Next myshape End Sub This will place all the pictures on the sheet in cell A1,A3,A7... Maybe this will give you some ideas Post back if you need help Sub test() Dim myshape As Shape Dim RW As Long RW = 1 For Each myshape In ActiveSheet.Shapes If myshape.Type = msoPicture Then With ActiveSheet.Range("A" & RW) myshape.Top = .Top myshape.Width = .Width myshape.Height = .Height myshape.Left = .Left myshape.Placement = xlMoveAndSize End With RW = RW + 3 End If Next myshape End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
Hi Blewyn
Activesheet.Pictures.Select This will also select controls from the Forms and Control Toolbox. Maybe it is no problem for you? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... with Shapes("Picture 1") .Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
Hi, Try this, ActiveSheet.Shapes("Image1").Top = 15 ActiveSheet.Shapes("Image1").Left = 1 ActiveSheet.Shapes.SelectAll Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
Control toolbox controls are selected, but not controls from the forms
toolbar or objects from the drawing toolbar (textboxes specifically). -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Hi Blewyn Activesheet.Pictures.Select This will also select controls from the Forms and Control Toolbox. Maybe it is no problem for you? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... with Shapes("Picture 1") .Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
Thanks for the correction Tom
I think it is a stupid name "Pictures" -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... Control toolbox controls are selected, but not controls from the forms toolbar or objects from the drawing toolbar (textboxes specifically). -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Hi Blewyn Activesheet.Pictures.Select This will also select controls from the Forms and Control Toolbox. Maybe it is no problem for you? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... with Shapes("Picture 1") .Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
The Pictures collection comes from the same Era as Buttons, Rectangles and
so forth. It was in xl5/xl95 before we had Control Toolbox Controls. I am surprised that it picks these up (control toolbox controls), but I suppose it has to do with how they are represented on the worksheet. In xl5/95, it could be used to select all the pictures. -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Thanks for the correction Tom I think it is a stupid name "Pictures" -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... Control toolbox controls are selected, but not controls from the forms toolbar or objects from the drawing toolbar (textboxes specifically). -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Hi Blewyn Activesheet.Pictures.Select This will also select controls from the Forms and Control Toolbox. Maybe it is no problem for you? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... with Shapes("Picture 1") .Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto-Size and Position Pictures with a Macro ?
Thanks for your answer Tom
-- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... The Pictures collection comes from the same Era as Buttons, Rectangles and so forth. It was in xl5/xl95 before we had Control Toolbox Controls. I am surprised that it picks these up (control toolbox controls), but I suppose it has to do with how they are represented on the worksheet. In xl5/95, it could be used to select all the pictures. -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Thanks for the correction Tom I think it is a stupid name "Pictures" -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... Control toolbox controls are selected, but not controls from the forms toolbar or objects from the drawing toolbar (textboxes specifically). -- Regards, Tom Ogilvy "Ron de Bruin" wrote in message ... Hi Blewyn Activesheet.Pictures.Select This will also select controls from the Forms and Control Toolbox. Maybe it is no problem for you? -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Tom Ogilvy" wrote in message ... with Shapes("Picture 1") .Top = range("B9").Top .Left = range("B9").Left End With You can also specify the Width and Left properties or scale the picture. If you need sample code, turn on the macro recorder and configure the picture manually. Activesheet.Pictures.Select -- Regards, Tom Ogilvy "blewyn" wrote in message om... How do I specify the position of a picture on a worksheet with a macro ? Also, is there a way to have a macro select all the pictures on a page, regardless of their object names ? Thanks, Blewyn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pictures and Text Boxes print in wrong position and size in 2007 | Excel Discussion (Misc queries) | |||
How to auto size jpeg files into excel when import/insert pictures | New Users to Excel | |||
Fix size and position of comment | Excel Discussion (Misc queries) | |||
Window Position & Size | Excel Discussion (Misc queries) | |||
i want to import all pictures into excel at the same size without. | Setting up and Configuration of Excel |