Skip to main content

在Outlook中將郵件保存為PDF文件:逐步指南

Author: Siluvia Last Modified: 2025-05-12

將重要郵件保存為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」後,您可以使用其「保存多封Email為PDF等類型」工具快速保存或導出選中的郵件為PDF文件/Excel文件/CSV文件或其他文件格式。

使用 Kutools for Outlook 解鎖極致郵件效率!永久免費獲取 70 項強大功能。立即下載免費版本

1. 在郵件文件夾中,選擇要保存為PDF的消息,點擊「Kutools」>「保存多封Email為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