KutoolsforOffice — 一套方案,五大工具。事半功倍。

如何在 Outlook 中一次性删除邮件的所有附件?

作者Kelly修改日期

通常在预览邮件时,您可以右键单击附件,然后选择移除附件,即可删除该附件。如果一封邮件中有多个附件,逐一删除会非常繁琐。下面为您介绍两种简单方法:一种可一键删除单封邮件的所有附件,另一种可批量删除多封邮件中的所有附件。

手动删除 Outlook 单封邮件中的所有附件
使用 VBA 代码在 Outlook 中批量删除多封邮件的所有附件
通过 Kutools for Outlook 轻松删除一封或多封邮件中所有附件


手动删除 Outlook 单封邮件中的所有附件

使用 Outlook 的移除附件功能,轻松删除所选邮件中的所有附件。

步骤 1:选中包含您想要删除附件的邮件。

步骤 2:在阅读窗格中单击任意附件,以激活附件工具。

doc-save-attachments-1

步骤 3:点击附件选项卡上选择组中的全选按钮。

doc-save-attachments-2

此步骤让您能够一键选中邮件中的所有附件。

步骤 4:单击附件选项卡上操作组中的移除附件按钮。

步骤 5:在警告对话框中,点击移除附件按钮。

doc-save-attachments-3

这样,所选邮件中的所有附件将会被立即删除。

注意:移除附件功能仅适用于 Outlook 2010 及以上版本,早期版本如 Outlook 2007 不支持该功能。


轻松删除 Outlook 中多封选定邮件的所有附件:

Kutools for Excel全部分离附件工具,可让您如演示所示,轻松删除多封选中邮件的所有附件(所有附件将保存在指定文件夹中)。立即下载并试用!30 天免费试用


使用 VBA 代码在 Outlook 中批量删除多封邮件的所有附件

如果您想在 Microsoft Outlook 中批量删除多封邮件的所有附件,可参考以下方法轻松实现。我们建议您 在 Microsoft Outlook 中启用所有宏

步骤 1:进入我的文档文件夹,新建一个新建文件夹,并将其命名为 OLAttachments

步骤 2:选中您需删除附件的多封邮件。

注意:按住 Ctrl 键的同时点击,即可选择多封不连续的邮件。

按住 Shift 键并点击,即可连续选中多封邮件。

步骤 3:同时按下 Alt 键和 F11 键,即可打开 VBA 编辑器。

步骤 4:在左侧栏下展开 Project 1 > Microsoft Outlook Objects,然后双击 ThisOutlookSession,即可在编辑器中打开。参见下图:

doc-delete-attachments-4

步骤 5:将以下 VBA 代码复制粘贴到编辑窗口。

Public Sub ReplaceAttachmentsToLink()
Dim objApp As Outlook.Application
Dim aMail As Outlook.MailItem 'Object
Dim oAttachments As Outlook.Attachments
Dim oSelection As Outlook.Selection
Dim i As Long
Dim iCount As Long
Dim sFile As String
Dim sFolderPath As String
Dim sDeletedFiles As String
 
    ' Get the path to your My Documents folder
    sFolderPath = CreateObject("WScript.Shell").SpecialFolders(16)
    On Error Resume Next
 
    ' Instantiate an Outlook Application object.
    Set objApp = CreateObject("Outlook.Application")
 
    ' Get the collection of selected objects.
    Set oSelection = objApp.ActiveExplorer.Selection
 
    ' Set the Attachment folder.
    sFolderPath = sFolderPath & "\OLAttachments"
 
    
    ' Check each selected item for attachments. If attachments exist,
    ' save them to the Temp folder and strip them from the item.
    For Each aMail In oSelection
 
    ' This code only strips attachments from mail items.
    ' If aMail.class=olMail Then
    ' Get the Attachments collection of the item.
    Set oAttachments = aMail.Attachments
    iCount = oAttachments.Count
     
       
    If iCount > 0 Then
     
        ' We need to use a count down loop for removing items
        ' from a collection. Otherwise, the loop counter gets
        ' confused and only every other item is removed.
         
        For i = iCount To 1 Step -1
         
            ' Save attachment before deleting from item.
            ' Get the file name.
            sFile = oAttachments.Item(i).FileName
             
            ' Combine with the path to the Temp folder.
            sFile = sFolderPath & "\" & sFile
             
            ' Save the attachment as a file.
            oAttachments.Item(i).SaveAsFile sFile
             
            ' Delete the attachment.
            oAttachments.Item(i).Delete
             
            'write the save as path to a string to add to the message
            'check for html and use html tags in link
            If aMail.BodyFormat <> olFormatHTML Then
                sDeletedFiles = sDeletedFiles & vbCrLf & "<file://" & sFile & ">"
            Else
                sDeletedFiles = sDeletedFiles & "<br>" & "<a href='file://" & _
                sFile & "'>" & sFile & "</a>"
            End If
             
                         
        Next i
        'End If
             
       ' Adds the filename string to the message body and save it
       ' Check for HTML body
       If aMail.BodyFormat <> olFormatHTML Then
           aMail.Body = aMail.Body & vbCrLf & _
           "The file(s) were saved to " & sDeletedFiles
       Else
           aMail.HTMLBody = aMail.HTMLBody & "<p>" & _
           "The file(s) were saved to " & sDeletedFiles & "</p>"
       End If
       
       aMail.Save
       'sets the attachment path to nothing before it moves on to the next message.
       sDeletedFiles = ""
    
       End If
    Next 'end aMail
     
ExitSub:
 
Set oAttachments = Nothing
Set aMail = Nothing
Set oSelection = Nothing
Set objApp = Nothing
End Sub

步骤 6:按下 F5 键即可运行该 VBA 代码。

现在所选邮件中的所有附件已被移除,每封邮件底部会自动保留已删除附件的超链接。

doc-delete-attachments-7


通过 Kutools for Outlook 轻松删除一封或多封邮件中的所有附件

Kutools for Outlook全部分离附件工具可帮助您快速批量删除 Outlook 中一封或多封选中邮件的所有附件。请按以下步骤操作。

Kutools for Outlook:内含 100 多款实用 Outlook 加载项,30 天免费试用,无任何功能限制

1. 选择一个或多个包含需删除附件的邮件,然后点击 Kutools> 附件工具> 全部分离。见截图:

doc-save-attachments-multiple-emails6

2. 在拆离设置对话框中,请按照以下方式进行设置。

  • 2.1 单击浏览按钮,选择用于保存所有已删除附件的文件夹位置。
  • 2.2 默认勾选按以下样式拆离附件选项框,您可根据需要选择是否将附件按邮件分别保存到不同文件夹中。
  • 2.3 单击确定按钮。如下图所示:

doc-save-attachments-multiple-emails7

注意事项
1. 如需将所有附件保存在同一文件夹,请取消勾选按照以下样式创建子文件夹选项框。
2. 删除附件后,邮件列表的邮件将不再显示附件图标。如需一直保留,请勾选拆离附件后,邮件依然保留附件图标选项框。
2. 除了删除选中邮件中全部附件,您也能根据特定条件删除部分附件。例如,仅需删除大于 500KB 的附件时,请点击高级选项按钮以展开条件设置,然后按下图配置。

doc-save-attachments-multiple-emails08

3. 在全部分离对话框内,点击按钮。

doc-save-attachments-multiple-emails9

4. 随后会弹出 Kutools for Outlook 对话框,告知您已成功删除的附件数量。请点击确定按钮。

doc-save-attachments-multiple-emails10

现在所有附件已立即移除,选中邮件中仅保留附件超链接。您可根据需要点击超链接打开对应附件。

如果您想免费试用此功能(30 天),请点击下载,然后按照上述步骤操作。


最佳办公效率工具

体验全新 Kutools for Outlook,畅享 100+ 强大功能!立即点击下载,不容错过!

🤖KUTOOLS AI采用先进 AI 技术,轻松处理邮件,涵盖回复、摘要、优化、扩展、翻译及撰写等功能。

📧 邮件自动化自动答复(支持 POP 和 IMAP)/定时发送邮件/发送邮件时按规则自动抄送密送/自动转发(高级规则)/自动添加称呼/自动将多收件人邮件拆分为单独信息……

📨 邮件管理撤回邮件/按主题等条件拦截诈骗邮件/删除重复邮件/高级搜索/整合文件夹……

📁 附件增强批量保存/批量分离/批量压缩/自动保存/自动拆离/自动压缩……

🌟 界面魔法😊更多美观时尚表情/重要邮件到达时提醒您/最小化 Outlook 而不是直接关闭……

👍 一键精彩功能带附件全部答复/反钓鱼邮件/🕘显示发送者当前时间时区……

👩🏼‍🤝‍👩🏻 联系人与日历批量从选定邮件中提取添加联系人/将联系人组拆分为个人组/移除生日提醒……

在您的首选语言中畅享 Kutools —— 支持英语、西班牙语、德语、法语、中文等 40 多种语言!

一键解锁 Kutools for Outlook,告别等待,立即下载,让效率倍增!

kutools for outlook 功能1kutools for outlook 功能2

🚀 一键下载 — 即可获取全部 Office 加载项

强烈推荐:Kutools for Office(5 合 1)

一键下载五个安装包,即可同时获得 Kutools for Excel、Outlook、Word、PowerPointOffice Tab Pro立即点击下载!

  • 一键便捷:只需一次操作,即可下载全部五个安装包。
  • 🚀 轻松应对各类 Office 任务:随时按需安装所需插件,助您高效办公,不容错过!
  • 🧰 包含:Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint