跳到主要內容

如何在Outlook中的文件夾中重命名和保存電子郵件附件?

在Outlook中,您通常會收到帶有附件的郵件,並且是否嘗試重命名郵件的附件並將其保存在文件夾中,如下面的屏幕快照所示? 顯然,您可以將它們保存到一個文件夾中並一一重命名,但是實際上,我有一個VBA代碼,可以快速重命名具有相同名稱的所有附件,然後保存在一個文件夾中。
doc重命名保存附件1

重命名附件並將其保存在文件夾中

使用Kutools for Outlook重命名附件並將其保存在文件夾中


在Outlook中回复帶有原始附件的郵件

眾所周知,當您在Outlook中將郵件回复給收件人時,附件將從原始郵件中刪除。 如果您想保留附件來回复按摩,可以嘗試 Kutools for Outlook's 帶附件回复 功能,它可以回復一封帶有原始附件的郵件,也適用於所有messafe。    單擊以獲取全部功能 60 天免費試用!
 
doc附上回复
 
Kutools for Outlook:帶有數十個方便的Outlook加載項,可以在60天內免費試用。
Office 標籤 - 在 Microsoft Office 中啟用選項卡式編輯和瀏覽,讓工作變得輕而易舉
Kutools for Outlook - 透過 100 多個進階功能增強 Outlook,實現卓越效率
使用這些進階功能增強您的 Outlook 2021 - 2010 或 Outlook 365。 享受全面的 60 天免費試用並提升您的電子郵件體驗!

重命名附件並將其保存在文件夾中

1.選擇要保存其附件的郵件,然後重命名為相同的名稱。

2。 按 Alt + F11 k嗯,然後在 Project1 窗格,雙擊 本次展望會議 在右側部分創建一個新的空白腳本,然後將代碼複製並粘貼到該腳本中。

VBA:重命名並保存附件

Public Sub SaveAttachsToDisk()
'UpdatebyExtendoffice20180521
Dim xItem As Object  'Outlook.MailItem
Dim xSelection As Selection
Dim xAttachment As Outlook.Attachment
Dim xFldObj As Object
Dim xSaveFolder As String
Dim xFSO As Scripting.FileSystemObject
Dim xFile As File
Dim xFilePath As String
Dim xNewName, xTmpName As String
Dim xExt As String
Dim xCount As Integer
On Error Resume Next
Set xFldObj = CreateObject("Shell.Application").browseforfolder(0, "Select a Folder", 0, 16)
Set xFSO = New Scripting.FileSystemObject
If xFldObj Is Nothing Then Exit Sub
xSaveFolder = xFldObj.Items.Item.Path & "\"
Set xSelection = Outlook.Application.ActiveExplorer.Selection
xNewName = InputBox("Attachment Name:", "Kutools for Outlook", xNewName)
If Len(Trim(xNewName)) = 0 Then Exit Sub
For Each xItem In xSelection
    For Each xAttachment In xItem.Attachments
        xFilePath = xSaveFolder & xAttachment.FileName
        xAttachment.SaveAsFile xFilePath
        Set xFile = xFSO.GetFile(xFilePath)
        xCount = 1
        Saved = False
        xExt = "." & xFSO.GetExtensionName(xFilePath)
        xTmpName = xNewName
        xNewName = xTmpName & xExt
        If xFSO.FileExists(xSaveFolder & xNewName) = False Then
            xFile.Name = xNewName
            xNewName = xTmpName
        Else
            xTmpName = Left(xNewName, Len(xNewName) - Len(xExt))
            While Saved = False
                xNewName = xTmpName & xCount & xExt
                If xFSO.FileExists(xSaveFolder & xNewName) = False Then
                    xFile.Name = xNewName
                    xNewName = xTmpName
                    Saved = True
                Else
                    xCount = xCount + 1
                End If
            Wend
        End If
    Next
Next
Set xFSO = Nothing
End Sub

doc重命名將附件保存在文件夾2中

3。 點擊 工具 > 參考,在彈出的對話框中,選中 Microsoft腳本運行時 複選框。

doc重命名將附件保存在文件夾3中 doc箭頭向右 doc重命名將附件保存在文件夾4中

4。 點擊 OK, 按 F5 運行代碼的關鍵 瀏覽文件夾 彈出對話框,用於選擇或創建用於放置附件的文件夾。
doc重命名將附件保存在文件夾5中

5。 點擊 OK,然後為附件命名。
doc重命名將附件保存在文件夾6中

6。 點擊 OK,現在附件將重命名為相同的名稱,如果有重複項,重複的附件將添加數字作為後綴。


使用Kutools for Outlook重命名附件並將其保存在文件夾中

其實有一個功能 Kutools for Outlook -Outlook的便捷加載項工具可以在保存或發送之前重命名所有附件。

Kutools for Outlook , 包括  Microsoft Outlook 2016、2013、2010和Office 365的強大功能和工具。

免費安裝 Kutools for Outlook,然後執行以下步驟:

1.根據需要在負窗格或“消息”框中激活電子郵件,單擊 庫工具 > 附件工具重命名全部.
doc重命名保存附件2

2.在彈出對話框中,鍵入用於每個附件的新名稱。 請點擊 OK,附件已使用新名稱重命名。
doc重命名保存附件3 

3.右鍵單擊一個附件,選擇 保存所有附件點擊此處成為Trail Hunter OK 並選擇一個文件夾以根據需要保存附件。 然後,已重命名的附件已保存在文件夾中。
doc重命名保存附件5 
doc重命名保存附件5


最佳辦公生產力工具

Kutools for Outlook - 超過 100 種強大的功能可增強您的 Outlook

🤖 人工智慧郵件助手: 具備人工智慧魔力的即時專業電子郵件——一鍵天才回覆、完美語調、多語言掌握。輕鬆改變電子郵件! ……

📧 電子郵件自動化: 外出(適用於 POP 和 IMAP)  /  安排發送電子郵件  /  發送電子郵件時按規則自動抄送/密件副本  /  自動轉送(進階規則)   /  自動添加問候語   /  自動將多收件者電子郵件拆分為單獨的訊息 ...

📨 電子郵件管理: 輕鬆回憶電子郵件  /  按主題和其他人阻止詐騙電子郵件  /  刪除重複的電子郵件  /  進階搜索  /  合併資料夾 ...

📁 附件專業版批量保存  /  批量分離  /  批量壓縮  /  自動保存   /  自動分離  /  自動壓縮 ...

🌟 介面魔法: 😊更多又漂亮又酷的表情符號   /  使用選項卡式視圖提高 Outlook 工作效率  /  最小化 Outlook 而不是關閉 ...

👍 一鍵奇蹟: 使用傳入附件回覆全部  /   反網路釣魚電子郵件  /  🕘顯示寄件者的時區 ...

👩🏼‍🤝‍👩🏻 通訊錄和行事曆: 從選定的電子郵件中大量新增聯絡人  /  將聯絡人群組拆分為各組  /  刪除生日提醒 ...

超過 100特點 等待您的探索! 按此處了解更多。

閱讀更多       免費下載      購買
 

 

Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks, it is ridiculous that we have to go to these lengths to do something that should be handled by the application
This comment was minimized by the moderator on the site
Hi! How can this work if having multiple emails? Is this only for multiple attachments in same email? Thanks!
This comment was minimized by the moderator on the site
Hey there! Do you know how we can improve the below code to rename the file when saved?

Public Sub UnzipFileInOutlook(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Users\acheng\Desktop"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder
Set objAtt = Nothing
Next
End Sub
This comment was minimized by the moderator on the site
Hello, Lipe, may be this code can help you.

Private Sub CopyToDefaultCalendarFld(ByVal Item As Object)
Dim xCopiedAppointment As Outlook.AppointmentItem
Dim xMovedAppointment As Outlook.AppointmentItem
Dim xMeeting As MeetingItem
Dim xApoint As AppointmentItem
On Error Resume Next
If Item.Class = olAppointment Then
Set xApoint = Item
Set xCopiedAppointment = xApoint.Copy
Set xMovedAppointment = xCopiedAppointment.Move(GMovedCalendarFolder)
If xApoint.Subject <> xMovedAppointment.Subject Then
If InStr(1, xMovedAppointment.Subject, "Copy: ") > 0 Then
xMovedAppointment.Subject = VBA.Replace(xMovedAppointment.Subject, "Copy: ", "", 1, 1)
xMovedAppointment.Save
End If
End If
ElseIf Item.Class = olMeetingRequest Then
Set xMeeting = Item
Set xCopiedAppointment = xMeeting.GetAssociatedAppointment(True).Copy
Set xMovedAppointment = xCopiedAppointment.Move(GMovedCalendarFolder)
If xMeeting.Subject <> xMovedAppointment.Subject Then
If InStr(1, xMovedAppointment.Subject, "Copy: ") > 0 Then
xMovedAppointment.Subject = VBA.Replace(xMovedAppointment.Subject, "Copy: ", "", 1, 1)
xMovedAppointment.Save
End If
End If
xCopiedAppointment.Delete
End If
Set xCopiedAppointment = Nothing
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations