【Word VBA】批量删除Word中图片与文本框等shape
Word中删除图片与文本框等shape
Sub DeleteShapes() Dim T Dim doc As Document Dim fd As FileDialog Dim vrtSelectedItem As Variant Set fd = Application.FileDialog(msoFileDialogFilePicker) With fd .Title = "拾取Word文档" .AllowMultiSelect = True .Filters.Add "Word File", "*.docx; *.doc", 1 If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems Documents.Open FileName:=vrtSelectedItem Set doc = ActiveDocument For i = 1 To doc.InlineShapes.Count doc.InlineShapes(1).Delete Next For i = 1 To doc.Shapes.Count doc.Shapes(1).Delete Next doc.Save doc.Close T = T + 1 Next End If End With MsgBox "操作完成!!" & Chr(10) & "处理了 " & T & " 个文件。", vbOKOnly, "提示" End Sub