S
Steven Drenker
I want to add a shape to a chart and control the text in the shape as
follows:
Dim shpDate As Shape
Set shpDate = ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 5,
20, 120, 30)
With shpDate
.Name = "Text Box Date"
.Characters.Text = Worksheets("D1.Ptin vs Comp").Range("A2") '<-- ERROR
End With
Apparently I am not allowed to access the .Characters.Text property of a
shape object. Instead I have to first select the shape and use the
selection:
ShpDate.select
Selection.Characters.Text = Worksheets("D1.Ptin vs Comp").Range("A2")
This seems awkward. When I have the shape object (shpDate), why can't I just
access it directly? Why do I have to use the indirect method of first
selecting the shape, then accessing the Characters.Text property?
Thanks!
Steve
follows:
Dim shpDate As Shape
Set shpDate = ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 5,
20, 120, 30)
With shpDate
.Name = "Text Box Date"
.Characters.Text = Worksheets("D1.Ptin vs Comp").Range("A2") '<-- ERROR
End With
Apparently I am not allowed to access the .Characters.Text property of a
shape object. Instead I have to first select the shape and use the
selection:
ShpDate.select
Selection.Characters.Text = Worksheets("D1.Ptin vs Comp").Range("A2")
This seems awkward. When I have the shape object (shpDate), why can't I just
access it directly? Why do I have to use the indirect method of first
selecting the shape, then accessing the Characters.Text property?
Thanks!
Steve