refined question

  • Thread starter Thread starter Jamie Martin
  • Start date Start date
J

Jamie Martin

I figured out how to change the text in a chart shape. However, my procedure
fails if there are any shapes on my chart that do not have any text. I tried
several ways around this, but they all gave me a runtime error. Here's an
example:

For Each Shp In Cht.Shapes
If (Shp.TextFrame.Characters.Text <> "") Then
Shp.TextFrame.Characters.Text = _
WorksheetFunction.Substitute _
(Shp.TextFrame.Characters.Text, Str1, Str2)
End If
Next Shp

I also tried "If(Shp.TextFrame Is Nothing) Then"

Can someone help? Thanks very much.

Jamie
 
On Error Resume Next
For Each Shp In Cht.Shapes
If (Shp.TextFrame.Characters.Text <> "") Then
Shp.TextFrame.Characters.Text = _
WorksheetFunction.Substitute _
(Shp.TextFrame.Characters.Text, Str1, Str2)
End If
Next Shp
On Error goto 0
 
Back
Top