Skip to content

Instantly share code, notes, and snippets.

@wilinz
Last active September 16, 2023 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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

删除 word 中的指定文本艺术字

在 Microsoft Word 中运行 VBA (Visual Basic for Applications) 宏的步骤如下:

首先,打开你想要运行宏的 Word 文档。

点击 "视图" 菜单,然后选择 "宏"。

在下拉菜单中,点击 "查看宏"。

在弹出的 "宏" 对话框中,你会看到一个名为 "宏名" 的列表。这个列表包含了当前文档或应用程序中所有可用的宏。

从 "宏名" 列表中,选择你想要运行的宏。

点击 "运行" 按钮,你选定的宏就会开始执行。

@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