Thread
:
Can I assign a macro to an autoshape using VBA?
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Can I assign a macro to an autoshape using VBA?
Here is one I use to name the shapes from a list of shapes in col A and the
name in col B
Should be easy to modify
Sub NameShapes()
Sheets("checks").Select
For Each c In [setup!a4:a15]
ActiveSheet.Shapes(c).TextFrame. _
Characters.Text = c.Offset(0, 1)
Next c
End Sub
--
Don Guillett
SalesAid Software
"madbloke" wrote in
message ...
Basically, I've got some code which dynamically generates macros based
on the amount of autoshapes on my worksheet - what I now need to do is
get the code to assign these macros to the autoshapes - I've tried
recording a macro and then assigning the macros manually, but all this
comes up with is
ActiveSheet.Shapes("shape").select
Selection.OnAction = "whateversub"
The autoshapes all have the same name, but a different number (I'm
using a variable to go through them 1 by 1, so I've amended it to
'ActiveSheet.Shapes("shape" & a).select')
This doesn't seem to do the trick, though.
Any ideas?
--
madbloke
------------------------------------------------------------------------
madbloke's Profile:
http://www.excelforum.com/member.php...o&userid=14422
View this thread:
http://www.excelforum.com/showthread...hreadid=527616
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett