View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Assigning Macro To Shape

Try something like this
I assume that the macro exist??


Sub test()
Dim Nsheet As Worksheet
Set Nsheet = Worksheets.Add
Nsheet.Shapes.AddShape(msoShapeRectangle, 100, 200, 150, 50).Select
Selection.OnAction = "yourmacro"
Nsheet.Range("A1").Select
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tommi" wrote in message ...
Hello!
I need to make a macro that will create a new worksheet, add a Shape-object
(any one which is similar to button), then assign a macro to that Shape.

I haven't been able to do this. The problem is how to select the
Shape-object properly.

Can you help me!

BR, Tommi