View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Stephens Mark Stephens is offline
external usenet poster
 
Posts: 124
Default How to add text box with macro attached

I am trying to add a series of text boxes to a sheet and assign each a
macro, I can add the text boxes ok, but i am unsure how to add a macro, this
is what I tried:

Set MyDocument = Worksheets("Charting")
MyDocument.Shapes.AddTextbox(msoTextOrientationHor izontal, 100, 100, 200,
50).TextFrame.Characters.Text = "Test Box"
Selection.OnAction = "Addtrendline"

Once I have added a shape how do I refer to it (oh how I hanker after the
days when I could just recor4d a macro to find out how to do stuff!).


Thanks and regards, mark