跳至主要内容

在Outlook中将邮件保存为PDF文件:分步指南

Author: Siluvia Last Modified: 2025-05-07

将重要邮件保存为PDF文件对于存档、共享或法律文件记录非常有用。Microsoft Outlook没有直接将邮件保存为PDF的选项,但您可以使用几种方法来实现这一目的。以下是如何在Outlook中将邮件保存为PDF文件的综合指南。

使用打印功能将邮件保存为PDF文件

使用VBA代码将选中的邮件保存为PDF文件

使用Kutools for Outlook将选中的邮件保存为PDF文件或其他文件格式


使用打印功能将邮件保存为PDF文件

如果您只想将一封邮件保存为PDF文件,打印功能可以帮助您完成。

1. 选择要保存为PDF文件的邮件。

2. 点击“文件”>“打印”。

3. 在打印机下拉菜单中,选择“Microsoft Print to PDF”,然后点击“打印”。

save an email as pdf file using print feature 1

4. 在“保存打印输出为”窗口中,选择目标文件夹,输入文件名,然后点击“保存”。

save an email as pdf file using print feature 2

使用VBA代码将选中的邮件保存为PDF文件

1. 首先,您应该选择要保存为PDF的邮件。

2. 按“Alt + F11”启动“Microsoft Visual Basic for Applications”窗口。

3. 点击“插入”>“模块”,然后复制并将以下VBA代码粘贴到模块窗口中。

save an email as pdf file using vba 1

将邮件保存为PDF文件的VBA代码

Sub SaveAsPDFfile()
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

注意:此VBA代码已在Outlook 2007和2010中成功测试

4. 点击 save an email as pdf file using vba 2 运行代码。

5. 运行代码时会弹出一个“文件保存”对话框。选择保存文件的路径,命名文件,最后点击“保存”按钮。

save an email as pdf file using vba 3

6. 当代码运行完成后,邮件已成功转换为PDF文件。


使用Kutools for Outlook将选中的邮件保存为PDF文件或其他文件格式

安装“Kutools for Outlook”后,您可以使用其“将选中的多封邮件保存为PDF等多种格式的文件”工具快速将选中的邮件保存或导出为PDF文件/Excel文件/CSV文件或其他文件格式。

使用Kutools for Outlook解锁无与伦比的邮件处理效率!永久免费获取 70 项强大功能。立即下载免费版本

1. 在邮件文件夹中,选择要保存为PDF的邮件,点击“Kutools”>“将选中的多封邮件保存为PDF等多种格式的文件”。

2. 在“保存邮件为其他文件”对话框中,选择放置新文件的路径,勾选“PDF 格式”,并根据需要指定“保存内容”。

save an email as pdf file using kutools for outlook 1

3. 点击“确定”。然后选中的邮件将分别保存为PDF文件。

save an email as pdf file using kutools for outlook 2