跳到主要内容

如何在Outlook中将多封电子邮件批量转换为pdf文件?

作者:孙 最后修改时间:2020-05-28

在Outlook中,“另存为”功能只能将电子邮件另存为HTML,TXT,MHT,MSG和模板格式文件,如果要将电子邮件转换为PDF文件,该怎么办? 在本文中,我将介绍一些解决此问题的技巧。

使用打印功能将一封电子邮件转换为PDF文件

使用VBA将一封电子邮件转换为PDF文件

使用另存为文件实用程序将批处理电子邮件转换为单独的PDF文件好主意3


使用打印功能将一封电子邮件转换为PDF文件

在Outlook中,可以使用“打印”功能将一封电子邮件另存为PDF文件。

1.选择要转换为PDF的电子邮件,单击 File > 打印, 选择 Microsoft Print to PDF 来自 Printer 下拉列表,然后单击 Print.
doc批处理将电子邮件转换为pdf 1

2.在 Save Print Output As 对话框中,选择一个路径放置文件,并为其命名。
doc批处理将电子邮件转换为pdf 2

3。 点击 Save和点击 Cancel 停止打印。
doc批处理将电子邮件转换为pdf 3

现在,所选消息已转换为PDF文件。

备注:此方法仅在Outlook 2016中有效。


使用VBA将一封电子邮件转换为PDF文件

如果您使用的是Outlook 2007或2010,则可以应用VBA代码将一封电子邮件转换为PDF文件。

1.选择一封电子邮件,然后按 Alt + F11 启用 Microsoft Visual Basic for Applications 窗口。

2。 点击 Insert > Module,然后将以下代码粘贴到 Module 脚本。

VBA:将电子邮件转换为pdf

Sub SaveAsPDFfile()
'UpdatebyExtendoffice
Dim MyOlNamespace As NameSpace
Dim MySelectedItem As MailItem
Dim Response As String
Dim FSO As Object, TmpFolder As Object
Dim tmpFileName As String
Dim wrdApp As Object
Dim wrdDoc As Object
Dim bStarted As Boolean
Dim dlgSaveAs As FileDialog
Dim fdfs As FileDialogFilters
Dim fdf As FileDialogFilter
Dim i As Integer
Dim WshShell As Object
Dim SpecialPath As String
Dim msgFileName As String
Dim strCurrentFile As String
Dim strName As String
Dim oRegEx As Object
Dim intPos As Long
Set MyOlNamespace = Application.GetNamespace("MAPI")
Set MySelectedItem = ActiveExplorer.Selection.Item(1)
Set FSO = CreateObject("Scripting.FileSystemObject")
tmpFileName = FSO.GetSpecialFolder(2)
strName = "email_temp.mht"
tmpFileName = tmpFileName & "\" & strName
MySelectedItem.SaveAs tmpFileName, 10
On Error Resume Next
Set wrdApp = GetObject(, "Word.Application")
If Err Then
Set wrdApp = CreateObject("Word.Application")
bStarted = True
End If
On Error GoTo 0
Set wrdDoc = wrdApp.Documents.Open(FileName:=tmpFileName, Visible:=False, Format:=7)
Set dlgSaveAs = wrdApp.FileDialog(msoFileDialogSaveAs)
Set fdfs = dlgSaveAs.Filters
i = 0
For Each fdf In fdfs
i = i + 1
If InStr(1, fdf.Extensions, "pdf", vbTextCompare) > 0 Then
Exit For
End If
Next fdf
dlgSaveAs.FilterIndex = i
Set WshShell = CreateObject("WScript.Shell")
SpecialPath = WshShell.SpecialFolders(16)
msgFileName = MySelectedItem.Subject
Set oRegEx = CreateObject("vbscript.regexp")
oRegEx.Global = True
oRegEx.Pattern = "[\/:*?""<>|]"
msgFileName = Trim(oRegEx.Replace(msgFileName, ""))
dlgSaveAs.InitialFileName = SpecialPath & "\" & msgFileName
If dlgSaveAs.Show = -1 Then
strCurrentFile = dlgSaveAs.SelectedItems(1)
If Right(strCurrentFile, 4) <> ".pdf" Then
Response = MsgBox("Sorry, only saving in the pdf-format is supported." & _
vbNewLine & vbNewLine & "Save as pdf instead?", vbInformation + vbOKCancel)
If Response = vbCancel Then
wrdDoc.Close 0
If bStarted Then wrdApp.Quit
Exit Sub
ElseIf Response = vbOK Then
intPos = InStrRev(strCurrentFile, ".")
If intPos > 0 Then
strCurrentFile = Left(strCurrentFile, intPos - 1)
End If
strCurrentFile = strCurrentFile & ".pdf"
End If
End If
wrdApp.ActiveDocument.ExportAsFixedFormat OutputFileName:= _
strCurrentFile, _
ExportFormat:=17, _
OpenAfterExport:=False, _
OptimizeFor:=0, _
Range:=0, _
From:=0, _
To:=0, _
Item:=0, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=0, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
End If
Set dlgSaveAs = Nothing
wrdDoc.Close
If bStarted Then wrdApp.Quit
Set MyOlNamespace = Nothing
Set MySelectedItem = Nothing
Set wrdDoc = Nothing
Set wrdApp = Nothing
Set oRegEx = Nothing
End Sub

doc批处理将电子邮件转换为pdf 4

3。 按 F5 键以启用“文件保存”对话框,选择一个文件夹来放置文件并为其命名。
doc批处理将电子邮件转换为pdf 5

4。 点击 Save.

Tips::如果代码无法运行,则可以尝试转到信任中心以检查“宏设置”部分中的“启用所有宏”选项。
doc批处理将电子邮件转换为pdf 6


使用另存为文件实用程序将批处理电子邮件转换为单独的PDF文件

使用上述方法,您一次只能将一封邮件另存为PDF文件,如果您想将多封电子邮件批量转换为单独的PDF文件,可以尝试 Kutools for Outlook批量保存 效用。

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

免费安装 Kutools for Outlook,然后执行以下步骤:

1.选择要转换的电子邮件,然后单击 Kutools > Bulk Save.
doc批处理将电子邮件转换为pdf 7

2.在 Save message as other files 对话框中,选择路径以找到文件,然后检查 PDF 格式选项,您可以在右侧查看有关保存内容的选项。
doc批处理将电子邮件转换为pdf 8

3。 点击 Ok.

现在,电子邮件已转换为PDF文件。
doc批处理将电子邮件转换为pdf 10


最佳办公生产力工具

Kutools for Outlook - 超过 100 种强大功能可增强您的 Outlook

🤖 人工智能邮件助手: 具有人工智能魔力的即时专业电子邮件——一键天才回复、完美语气、多语言掌握。轻松改变电子邮件! ...

📧 电子邮件自动化: 外出(适用于 POP 和 IMAP)  /  安排发送电子邮件  /  发送电子邮件时按规则自动抄送/密件抄送  /  自动转发(高级规则)   /  自动添加问候语   /  自动将多收件人电子邮件拆分为单独的消息 ...

📨 电子邮件管理: 轻松回忆电子邮件  /  按主题和其他人阻止诈骗电子邮件  /  删除重复的电子邮件  /  高级搜索  /  合并文件夹 ...

📁 附件专业版批量保存  /  批量分离  /  批量压缩  /  自动保存   /  自动分离  /  自动压缩 ...

🌟 界面魔法: 😊更多又漂亮又酷的表情符号   /  使用选项卡式视图提高 Outlook 工作效率  /  最小化 Outlook 而不是关闭 ...

👍 一键奇迹: 使用传入附件回复全部  /   反网络钓鱼电子邮件  /  🕘显示发件人的时区 ...

👩🏼‍🤝‍👩🏻 通讯录和日历: 从选定的电子邮件中批量添加联系人  /  将联系人组拆分为各个组  /  删除生日提醒 ...

超过 100特点 等待您的探索! 单击此处了解更多。

了解更多       免费下载      购买
 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations