Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Maddison Hughes   on Aug 10 In MS Office Category.

  
Question Answered By: Burk Martin   on Aug 10

Here is some very simple code that will go through all the shapes  on
the activesheet trying to update the text.

Sub ReplaceShapeText()
'
' Find and Replace text  in shapes
'
Dim shpTemp As Shape
Dim strFindText As String
Dim strReplaceText As String
Dim intPos As Integer

strFindText = "abc"
strReplaceText = "xyz"

On Error Resume Next

For Each shpTemp In ActiveSheet.Shapes
intPos = 0
' case sensitive
intPos = InStr(1, shpTemp.TextFrame.Characters.Text,
strFindText)
If intPos > 0 Then
shpTemp.TextFrame.Characters.Text =
Application.WorksheetFunction.Substitute
(shpTemp.TextFrame.Characters.Text, strFindText, strReplaceText, 1)
End If
Next
End Sub

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Need to Capture Shapes Or get search suggestion and latest updates.


Tagged: