跳到主要內容

如何僅在Outlook中從一封電子郵件或選定的電子郵件中打印附件?

在Outlook中,您可以打印電子郵件,但是您是否僅在Outlook中從一封電子郵件或選定的電子郵件中打印附件? 在本文中,我將介紹解決這項工作的技巧。

僅從一封帶有“快速打印”的電子郵件中打印附件

僅使用VBA從選定的電子郵件中打印附件


僅從一封帶有“快速打印”的電子郵件中打印附件

要僅打印不帶電子郵件正文的附件,可以使用快速打印功能。

1.在消息窗口中,右鍵單擊要打印的附件,選擇 快速打印 從上下文菜單。
doc列印附件1

2。 然後點擊 節省 > 節省 將附件文件保存在某個位置。
doc列印附件2
doc列印附件3

3.現在轉到放置附件文件的位置,然後打開文件以照常打印。


僅使用VBA從選定的電子郵件中打印附件

如果要從選定的電子郵件中打印附件,則可以使用VBA代碼。

1.選擇要打印附件的電子郵件,然後按 Alt + F11鍵 啟用鍵 Microsoft Visual Basic for Applications 窗口。

2。 雙擊 本次展望會議 Project1 窗格,將下面的代碼複製並粘貼到腳本中。

VBA:從選定的電子郵件中打印附件

Sub BatchPrintAllAttachmentsInMultipleEmails()
'UpdatebyExtendoffice20180417
Dim xFSO As Scripting.FileSystemObject
Dim xTmpFldPath As String
Dim xSelection As Outlook.Selection
Dim xItem As Object
Dim xMailItem As Outlook.MailItem
Dim xAttachments As Outlook.Attachments
Dim xAttachment As Outlook.Attachment
Dim xShell As Object
Dim xTempFolder As Object
Dim xTempFolderItem As Object
Dim xFilePath As String
On Error Resume Next
Set xFSO = CreateObject("Scripting.FileSystemObject")
xTmpFldPath = xFSO.GetSpecialFolder(2).Path & "\Temp for Attachments"
If xFSO.FolderExists(xTmpFldPath) = False Then
    xFSO.CreateFolder xTmpFldPath
End If
Set xSelection = Outlook.Application.ActiveExplorer.Selection
Set xShell = CreateObject("Shell.Application")
Set xTempFolder = xShell.NameSpace(0)
For Each xItem In xSelection
    If xItem.Class = olMail Then
        Set xMailItem = xItem
        If xMailItem.Attachments.Count = 0 Then Exit Sub
        Set xAttachments = xMailItem.Attachments
        For Each xAttachment In xAttachments
            xFilePath = xTmpFldPath & "\" & xAttachment.FileName
            xAttachment.SaveAsFile (xFilePath)
            Set xTempFolderItem = xTempFolder.ParseName(xFilePath)
            xTempFolderItem.InvokeVerbEx ("print")
        Next
    End If
Next

'If xFSO.FolderExists(xTmpFldPath) Then
'    xFSO.DeleteFolder xTmpFldPath, True
'End If
End Sub

doc列印附件4

3。 然後點擊 工具 > 參考,並在中 參考 對話框,檢查 Microsoft腳本運行時 複選框。
doc列印附件5   doc列印附件6

4。 點擊 OK,然後按 F5 鍵以批量打印所選電子郵件中的所有附件。

備註:如果附件為圖片,則會彈出一個 打印圖片 首先單擊對話框 列印保存打印輸出為 對話。
doc列印附件7


最佳辦公生產力工具

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
how do you print attachments in multiple emails but with a certain page range
This comment was minimized by the moderator on the site
I tried the multiple emails option of pasting the VBA code, but when I press F5 to run it, I get a syntax error with this line highlighted:
If xItem.Class = olMail Then


Any ideas?
This comment was minimized by the moderator on the site
Have you check the Microsoft Scripting Runtime checkbox?
This comment was minimized by the moderator on the site
how can I enable the macro's? Last week it worked perfectly.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations