Skip to main content

如何在Outlook中帶原始附件進行全部答覆?

Author: Xiaoyang Last Modified: 2025-05-12

是否曾在Outlook中點擊「全部答覆」卻丟失了原始附件?這確實令人沮喪!想知道在答覆所有人時如何保留這些附件嗎?是的,這是可行的!讓我們來探索如何在您的答覆中包含原始附件,使郵件管理變得無縫且高效。請繼續關注!

使用VBA代碼進行帶原始附件的全部答覆

使用Kutools for Outlook進行帶原始附件的全部答覆


使用VBA代碼進行帶原始附件的全部答覆

Outlook中沒有直接的功能來處理此任務,但您可以應用以下VBA代碼來實現它。請按照以下步驟操作:

1. 啟動Outlook,然後按住ALT + F11鍵以打開Microsoft Visual Basic for Applications窗口。

2. 在Microsoft Visual Basic for Applications窗口中,雙擊Project1(VbaProject.OTM)窗格中的 ThisOutlookSession以打開模式,然後將以下代碼複製並粘貼到空白模塊中。

VBA代碼:帶原始附件的全部答覆:

Sub ReplyAllWithAttachments()
'Updateby Extendoffice
Dim xItem As Object
On Error Resume Next
Select Case TypeName(Outlook.Application.ActiveWindow)
Case "Explorer"
For Each xItem In Outlook.Application.ActiveExplorer.Selection
GetReplyItem xItem
Next
Case "Inspector"
Set xItem = Outlook.Application.ActiveInspector.CurrentItem
GetReplyItem xItem
End Select
Set xItem = Nothing
End Sub
Sub GetReplyItem(Item As Object)
Dim xReplyMailItem As Outlook.MailItem
On Error Resume Next
If Not Item Is Nothing Then
Set xReplyMailItem = Item.ReplyAll
GetAttachments Item, xReplyMailItem
xReplyMailItem.Display
'xReplyMailItem.Send
Item.UnRead = False
End If
Set xReplyMailItem = Nothing
End Sub
Sub GetAttachments(xSourceItem, xTargetItem)
Dim xFSO As Scripting.FileSystemObject
Dim xTmpPath As String
Dim xAttachment As Attachment
Dim xTmpFile As String
On Error Resume Next
Set xFSO = New Scripting.FileSystemObject
xTmpPath = CreateObject("shell.Application").NameSpace(5).self.Path & "\TmpAttachments\"
If xFSO.FolderExists(xTmpPath) = False Then
MkDir xTmpPath
End If
For Each xAttachment In xSourceItem.Attachments
If IsEmbeddedAttachment(xAttachment) = False Then
xTmpFile = xTmpPath & xAttachment.FileName
xAttachment.SaveAsFile xTmpFile
xTargetItem.Attachments.Add xTmpFile, , , xAttachment.DisplayName
xFSO.DeleteFile xTmpFile
End If
Next
If xFSO.FolderExists(xTmpPath) Then
Kill xTmpPath
End If
Set xFSO = Nothing
End Sub
Function IsEmbeddedAttachment(Attach As Attachment)
Dim xAttParent As Object
Dim xCID As String, xID As String
Dim xHTML As String
On Error Resume Next
Set xAttParent = Attach.Parent
xCID = ""
xCID = Attach.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")
If xCID <> "" Then
xHTML = xAttParent.HTMLBody
xID = "cid:" & xCID
If InStr(xHTML, xID) > 0 Then
IsEmbeddedAttachment = True
Else
IsEmbeddedAttachment = False
End If
End If
End Function
doc reply all with attachment 1

3. 然後在Microsoft Visual Basic for Applications窗口中點擊 Tools > References,在彈出的References-Project1對話框中,從Available References列表框中勾選Microsoft Scripting Runtime選項,參見截圖:

doc reply all with attachment 9

4. 然後保存並關閉代碼窗口,接著您可以將宏按鈕添加到快速訪問工具欄中。

5. 打開您要在消息窗口中帶附件進行全部答覆的郵件,然後從自定義快速訪問工具欄下拉菜單中選擇More Commands,參見截圖:

doc reply all with attachment 2

6. 在Outlook Options對話框中,執行以下操作:

(1.) 從Choose commands from下拉列表中選擇Macros

(2.) 點擊剛才插入的宏名稱;

(3.) 然後點擊Add按鈕將宏添加到自定義快速訪問工具欄中。

doc reply all with attachment 3

7. 然後點擊OK關閉對話框,現在,宏按鈕已插入到快速訪問工具欄中,參見截圖:

doc reply all with attachment 4

8. 現在,點擊宏按鈕,帶有原始附件的答覆消息窗口被打開,然後編寫答覆消息,並點擊Send按鈕,參見截圖:

doc reply all with attachment 5

使用Kutools for Outlook進行帶原始附件的全部答覆

如果您有Kutools for Outlook,使用其Reply All with Attachment功能,只需一次點擊即可進行帶附件的全部答覆。

使用 Kutools for Outlook 解鎖極致郵件效率!永久免費獲取 70 項強大功能。立即下載免費版本

安裝Kutools for Outlook後,請這樣操作:

1. 選擇要帶附件進行全部答覆的消息,然後點擊Kutools > Reply All with Original Attachment,參見截圖:

doc reply all with attch kto 1

2. 帶有原始附件的答覆消息窗口被打開,然後編寫您的消息並發送,參見截圖:

doc reply all with attachment 7

立即點擊下載Kutools for Outlook免費版本!