Skip to content

Instantly share code, notes, and snippets.

@wilinz
Last active September 16, 2023 09:03
Show Gist options
  • Save wilinz/83ac74d25717e36348717ad1b7245c80 to your computer and use it in GitHub Desktop.
Save wilinz/83ac74d25717e36348717ad1b7245c80 to your computer and use it in GitHub Desktop.
delete all wordArt
Sub DeleteArtisticText()
Dim oShape As Shape
Dim toDelete As New Collection
Dim targetTexts() As Variant
' Specify the texts you want to delete
targetTexts = Array("Text1", "Text2", "Text3") ' Add your specific texts here
' First, find all shapes to delete and add them to the collection
For Each oShape In ActiveDocument.Shapes
If oShape.Type = msoTextEffect Then
' Check if the text matches any of the target texts
For Each targetText In targetTexts
If oShape.TextEffect.Text = targetText Then
toDelete.Add oShape
Exit For ' No need to check the remaining texts if a match is found
End If
Next targetText
End If
Next oShape
' Now, delete the shapes
For Each oShape In toDelete
oShape.Delete
Next oShape
End Sub
@wilinz
Copy link
Author

wilinz commented Sep 16, 2023

请注意,您需要将 Array("Text1", "Text2", "Text3") 中的 "Text1", "Text2" 和 "Text3" 替换为您想要删除的具体文本。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment