Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
Is there a way to automaticlly assign a macro to and autoshape object in VB,
if there is Could some please help. Thanks. |
#2
![]() |
|||
|
|||
![]() ActiveSheet.Shapes("Autoshape 2").OnAction = "myMacro" -- HTH RP (remove nothere from the email address if mailing direct) "skid812pb" wrote in message ... Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. |
#3
![]() |
|||
|
|||
![]()
Thanks that worked great, but now I have another problem, I have several
autoshapes on my worksheet and I need to find a way to tell which shape was selected if it is possible Thanks again "skid812pb" wrote: Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. |
#4
![]() |
|||
|
|||
![]()
You're assigning the same macro to various shapes and want to determine which
shape was clicked on to start the macro? If yes, then you can use Application.caller to get the name of the shape. And you can find out more about the shape, too: Option Explicit Sub testme() Dim myShape As Shape MsgBox Application.Caller Set myShape = ActiveSheet.Shapes(Application.Caller) With myShape MsgBox .Name & vbLf & .TopLeftCell.Address End With End Sub skid812pb wrote: Thanks that worked great, but now I have another problem, I have several autoshapes on my worksheet and I need to find a way to tell which shape was selected if it is possible Thanks again "skid812pb" wrote: Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. -- Dave Peterson |
#5
![]() |
|||
|
|||
![]()
Thanks Dave, That is what I was Lookin for.
"Dave Peterson" wrote: You're assigning the same macro to various shapes and want to determine which shape was clicked on to start the macro? If yes, then you can use Application.caller to get the name of the shape. And you can find out more about the shape, too: Option Explicit Sub testme() Dim myShape As Shape MsgBox Application.Caller Set myShape = ActiveSheet.Shapes(Application.Caller) With myShape MsgBox .Name & vbLf & .TopLeftCell.Address End With End Sub skid812pb wrote: Thanks that worked great, but now I have another problem, I have several autoshapes on my worksheet and I need to find a way to tell which shape was selected if it is possible Thanks again "skid812pb" wrote: Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Dave,
Just found this thread. I was looking for something similar, BUT, when selecting the shape, I want the shape name to be used as criteria1 in my small one liner macro .... Selection.AutoFilter Field:=1, Criteria1:="M/162", rembering I hav many shapes and do not want an individual macro for each. Cheers "Dave Peterson" wrote: You're assigning the same macro to various shapes and want to determine which shape was clicked on to start the macro? If yes, then you can use Application.caller to get the name of the shape. And you can find out more about the shape, too: Option Explicit Sub testme() Dim myShape As Shape MsgBox Application.Caller Set myShape = ActiveSheet.Shapes(Application.Caller) With myShape MsgBox .Name & vbLf & .TopLeftCell.Address End With End Sub skid812pb wrote: Thanks that worked great, but now I have another problem, I have several autoshapes on my worksheet and I need to find a way to tell which shape was selected if it is possible Thanks again "skid812pb" wrote: Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Check your other post.
But your criteria seems to have changed. I wouldn't use slashes in names of shapes. I'd use an underscore. So if you're using xl2k or higher, make a change: ...., Criteria1:=" " & replace(myShape.Name, "_", "/") Scoop wrote: Hi Dave, Just found this thread. I was looking for something similar, BUT, when selecting the shape, I want the shape name to be used as criteria1 in my small one liner macro .... Selection.AutoFilter Field:=1, Criteria1:="M/162", rembering I hav many shapes and do not want an individual macro for each. Cheers "Dave Peterson" wrote: You're assigning the same macro to various shapes and want to determine which shape was clicked on to start the macro? If yes, then you can use Application.caller to get the name of the shape. And you can find out more about the shape, too: Option Explicit Sub testme() Dim myShape As Shape MsgBox Application.Caller Set myShape = ActiveSheet.Shapes(Application.Caller) With myShape MsgBox .Name & vbLf & .TopLeftCell.Address End With End Sub skid812pb wrote: Thanks that worked great, but now I have another problem, I have several autoshapes on my worksheet and I need to find a way to tell which shape was selected if it is possible Thanks again "skid812pb" wrote: Is there a way to automaticlly assign a macro to and autoshape object in VB, if there is Could some please help. Thanks. -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mouse over effect on autoshape | Charts and Charting in Excel | |||
Rename autoshape | Excel Discussion (Misc queries) | |||
Text in autoshape not displayed | Excel Discussion (Misc queries) | |||
AutoShape Positioning? | Excel Discussion (Misc queries) | |||
Put an autoshape in a cell based on another cells content | Excel Worksheet Functions |