looping through text boxes

  • Thread starter Thread starter Ian Mangelsdorf
  • Start date Start date
I

Ian Mangelsdorf

Hi all

I have a chart sheet that I have put several textboxes onto all linked
to various variables. At the moments I am using this code for each
instance

With ActiveChart.TextBoxes.Add(45, 90, 150, 20)
.Select
.Text = "Well: " & Well_Name
End With
With Selection.Characters(Start:=1, Length:=30).Font
.Name = "times new roman"
.FontStyle = "Regular"
.Size = 12
End With

How can I loop through all the textboxes once they have been created
and change the font and size. I think its somthing along the lines of

for each Textbox in activechart
FORMAT
next textbox

Im trying this in several versions but always end up with "Object
doesnt support this property or method"

how should I be referencing each textbox

Cheers

Ian
 
Ian

Try the code below. You will have to change the name of the chart accordingly.

Tony


ActiveSheet.ChartObjects("Chart 3").Activate

For Each te In ActiveChart.TextBoxes
With te.Font
.Name = "times new roman"
.FontStyle = "regular"
.Size = 15
End With
Next te

----- Ian Mangelsdorf wrote: -----

Hi all

I have a chart sheet that I have put several textboxes onto all linked
to various variables. At the moments I am using this code for each
instance

With ActiveChart.TextBoxes.Add(45, 90, 150, 20)
.Select
.Text = "Well: " & Well_Name
End With
With Selection.Characters(Start:=1, Length:=30).Font
.Name = "times new roman"
.FontStyle = "Regular"
.Size = 12
End With

How can I loop through all the textboxes once they have been created
and change the font and size. I think its somthing along the lines of

for each Textbox in activechart
FORMAT
next textbox

Im trying this in several versions but always end up with "Object
doesnt support this property or method"

how should I be referencing each textbox

Cheers

Ian
 
Back
Top