Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2012, 03:24 PM
Authorized User
 
Join Date: Sep 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dealing with Shapes

Does anyone know of any good primers that show you how to deal with shapes? I have been hobbling together code by recording Macros but I am unable to do a few key things.

I am trying to refer to a specific shape on the sheet that I did not create. Is there someway to pull the shape out of the collection and reference it?

I've tried:

Code:
Activesheet.shapes(1).select
 
Old January 16th, 2013, 11:50 PM
Registered User
 
Join Date: Jan 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Addressing shapes

Dude

I'm not sure I know exactly what you mean, but here goes:

If you have a shape called "Button1" on the active sheet and you want to select it, you would go:
ActiveSheet.Shapes("Button1").Select

Other things you might do would include:
ActiveSheet.Shapes("Button1").Width = 35.5
(similar for height, top and left)

You find out the name of the shape by selecting it and looking in the name box just above the column header for Column A (the same place where you see Range names. You can change the names of shapes in there too.

If you enter a standard shape via Insert .. Shapes, it will have a default name like "Rectangle1" or "Isosceles Triangle23". As I mentioned above, you can change these default names, by selecting the object and overtyping the existing name in the Name Box. BUT you have to present <Enter> (not <Return>) to confirm the name; otherwise it won't stick.





Similar Threads
Thread Thread Starter Forum Replies Last Post
.Shapes.AddFormControl(xlListBox Wall st Guru Excel VBA 0 March 18th, 2006 08:36 AM
Drawing Shapes cbulutlar Javascript 2 March 6th, 2006 02:25 PM
drawing shapes (advanced) FFinn Javascript How-To 1 September 28th, 2005 10:19 AM
Dragging shapes rajanikrishna Pro VB 6 0 October 19th, 2004 08:35 PM
saving images and shapes together saiyedriyaz BOOK: Beginning Java 2 1 June 12th, 2004 08:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.