跳到主要内容

如何仅在Outlook中从一封电子邮件或选定的电子邮件中打印附件?

在Outlook中,您可以打印电子邮件,但是您是否仅在Outlook中从一封电子邮件或选定的电子邮件中打印附件? 在本文中,我将介绍解决这项工作的技巧。

仅从一封带有“快速打印”的电子邮件中打印附件

仅使用VBA从选定的电子邮件中打印附件


仅从一封带有“快速打印”的电子邮件中打印附件

要仅打印不带电子邮件正文的附件,可以使用快速打印功能。

1.在消息窗口中,右键单击要打印的附件,选择 快速打印 从上下文菜单。
doc列印附件1

2。 然后点击 保存 > 保存 将附件文件保存在某个位置。
doc列印附件2
doc列印附件3

3.现在转到放置附件文件的位置,然后打开文件以照常打印。


仅使用VBA从选定的电子邮件中打印附件

如果要从选定的电子邮件中打印附件,则可以使用VBA代码。

1.选择要打印附件的电子邮件,然后按 Alt + F11键 启用键 Microsoft Visual Basic应用程序 窗口。

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