[VBA-Word02]批量删除word图片(嵌入型).txt
Sub Del_image()
    Dim fp As String    
    Dim fn As String 
    Dim d As Document  
    Dim i As InlineShape 

    With Application.FileDialog(msoFileDialogFolderPicker)
        If .Show = -1 Then
            fp = .SelectedItems(1)
        Else
            MsgBox "No folder selected."
            Exit Sub
        End If
    End With
    
    fn = Dir(fp & "\*.doc*")
    
    Do While fn <> ""
        Set d = Documents.Open(fp & "\" & fn)
        
        For Each i In d.InlineShapes
            i.Delete
        Next i

        d.Close SaveChanges:=True
        fn = Dir
    Loop
    
    MsgBox "批量删除成功!",,"逗号技巧"
End Sub
返回视频教程