Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default refined question

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default refined question

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


--
Regards,
Tom Ogilvy


Jamie Martin wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
IF question Alyssa Excel Discussion (Misc queries) 2 August 14th 09 08:26 PM
where can I see my question and answer? Yesterday I ask a question IP Excel Discussion (Misc queries) 2 May 10th 08 04:08 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM


All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"