跳至主要内容

Kutools for Office — 一套工具,五种功能。事半功倍。

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

Author Kelly Last modified

通常,当您预览电子邮件时,可以通过右键单击并选择“删除附件”选项来删除附件。有时一封电子邮件中可能包含多个附件,逐个删除它们会非常繁琐。在这里,我们为您提供两种简单的方法,可以一次性删除一封邮件中的所有附件,也可以删除多封邮件中的所有附件。

手动删除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:在左侧栏中展开Project1 > 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的“拆离所有附件”工具可以快速从一封或多封选定邮件中删除所有附件。请按照以下步骤操作。

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 每)此工具,请点击下载地址,然后按照上述步骤进行应用操作。


最佳 Office 办公效率工具

最新消息:Kutools for Outlook 推出免费版!

体验全新 Kutools for Outlook,超过100 种强大功能!立即点击下载!

🤖 Kutools AI 采用先进的 AI 技术,轻松处理邮件,包括答复、总结、优化、扩展、翻译和撰写邮件。

📧 邮箱自动化自动答复(支持 POP 和 IMAP) /计划发送邮件 /发送邮件时按规则自动抄送密送 / 自动转发(高级规则) / 自动添加问候语 / 自动将多收件人的邮件分割为单独邮件 ...

📨 邮件管理撤回邮件 / 按主题及其他条件阻止欺诈邮件 / 删除重复邮件 / 高级搜索 / 整合文件夹 ...

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

🌟 界面魔法😊更多美观酷炫的表情 /重要邮件到达时提醒 / 最小化 Outlook 而非关闭 ...

👍 一键高效操作带附件全部答复 / 防钓鱼邮件 / 🕘显示发件人时区 ...

👩🏼‍🤝‍👩🏻 联系人与日历批量添加选中邮件中的联系人 / 分割联系人组为单独的组 / 移除生日提醒 ...

可根据您偏好选择 Kutools 使用语言——支持英语、西班牙语、德语、法语、中文及40 多种其他语言!

只需点击一下即可立即激活 Kutools for Outlook。无需等待,立即下载,提升工作效率!

kutools for outlook features1 kutools for outlook features2

🚀 一键下载——获取所有 Office 插件

强烈推荐:Kutools for Office(五合一)

一键下载五个安装包Kutools for Excel、Outlook、Word、PowerPoint以及 Office Tab Pro 立即点击下载!

  • 一键便利操作:一次下载全部五个安装包。
  • 🚀 随时满足 Office任务需求:需要哪个插件随时安装即可。
  • 🧰 包含:Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint