Last active
September 16, 2023 09:03
-
-
Save wilinz/83ac74d25717e36348717ad1b7245c80 to your computer and use it in GitHub Desktop.
delete all wordArt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
请注意,您需要将 Array("Text1", "Text2", "Text3") 中的 "Text1", "Text2" 和 "Text3" 替换为您想要删除的具体文本。