KutoolsforOffice — 一套方案,五大工具。事半功倍。三月特賣:20% 折扣

如何在 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 物件,然後雙擊 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

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,內含 100+ 項超強功能!立即點擊下載!

🤖KUTOOLS AI運用先進 AI 技術,輕鬆處理電子郵件——無論是回覆、摘要、優化、擴充、翻譯還是撰寫郵件,通通一鍵搞定!

📧 郵件自動化自動答覆(支援 POP 與 IMAP)預約寄送郵件寄信時依規則自動抄送密送自動轉發(高級規則)自動加入問候語自動將多收件人郵件拆分為個別訊息……

📨 郵件管理撤回郵件依主旨等條件封鎖詐騙郵件刪除重複郵件高級搜尋整合文件夾……

📁 附件專業版批次儲存批次解除附加批次壓縮自動保存自動拆離自動壓縮……

🌟 介面魔法😊更多精美酷炫表情符號重要郵件來到時提醒您最小化 Outlook 而非關閉……

👍 一鍵奇蹟帶附件全部答復防釣魚郵件🕘顯示發送者當前時間時區……

👩🏼‍🤝‍👩🏻 聯絡人與行事曆從選取的郵件中批次新增聯絡人將聯繫人組拆分為個別群組移除生日提醒……

用您的慣用語言暢享 Kutools — 完整支援英文、西班牙文、德文、法文、中文等 40 多種語言!

立即一鍵解鎖 Kutools for Outlook!別再等待,馬上下載,全面提升工作效率!

kutools for outlook features1kutools for outlook features2

🚀 一鍵下載 — 立即取得所有 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