Is there a possible way to update wordart's text using macro?

masterms

New Member
Joined
Apr 27, 2024
Messages
7
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
Is there a possible way to update wordart's text using macro?

I got a wordart with text "aaa" in it, I want to update text to "bbb" using vba

office 2007
 
Seems like you could just change this bit of code...
VBA Code:
Dim shp As Object
For Each shp In doc.InlineShapes
If shp.Type = msoTextEffect Then
If Not shp.TextEffect Is Nothing Then
    msg = msg & shp.TextEffect.Text & vbCrLf
End If
End If
Next shp
HTH. Dave
YOU SAVED MY DAY! THAAAAAANKS!!!

codes are tested!
VBA Code:
Sub test1()

Dim pFindTxt As String
Dim pReplaceTxt As String
Dim rngStory As Word.Range
Dim oShp As Object ' HERE IS THE KEY!
Dim iShp As Integer

pFindTxt = "111"
pReplaceTxt = "222"

For Each rngStory In ActiveDocument.StoryRanges
        iShp = rngStory.InlineShapes.Count
        If iShp > 0 Then
            Debug.Print ("found inlineShape:" & iShp)
            For Each oShp In rngStory.InlineShapes
                Debug.Print ("processing")

                oShp.TextEffect.Text = Replace(oShp.TextEffect.Text, pFindTxt, pReplaceTxt)
                Debug.Print ("effect:" & oShp.TextEffect.Text)
               
            Next oShp

        End If
       
        iShp = rngStory.ShapeRange.Count
        If iShp > 0 Then
            Debug.Print ("found normalShape:" & iShp)
            For Each oShp In rngStory.ShapeRange
                Debug.Print ("processing")

                oShp.TextEffect.Text = Replace(oShp.TextEffect.Text, pFindTxt, pReplaceTxt)
                Debug.Print ("effect:" & oShp.TextEffect.Text)
               
            Next oShp

        End If

Next

End Sub
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,641
Messages
6,125,986
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top