Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to add text box with macro attached
Here is an example right from the Recorder:
Sub Macro1() ' ' Macro1 Macro ' Macro recorded 4/20/2009 by James Ravenswood ' ' ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 258#, 42.75, _ 150.75, 82.5).Select Selection.Characters.Text = "Here is a Textbox" With Selection.Characters(Start:=1, Length:=17).Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Range("A1").Select ActiveSheet.Shapes("Text Box 1").Select Selection.OnAction = "checkout" Range("A1").Select End Sub -- Gary''s Student - gsnu200847 "mark Stephens" wrote: 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
task bar attached macro name probles | Excel Programming | |||
running an XLS Macro from within an XLS attached as Object | Excel Programming | |||
Adding text to body of email with workbook attached. | Excel Programming | |||
Macro attached to button runs twice | Excel Programming | |||
MACRO ATTACHED TO A TOOLBAR BUTTON | Excel Programming |