Skip to main content

How to save email as pdf file in Outlook?

If you are working with Microsoft Outlook 2010 and 2007, you will find that there is no build-in in Outlook to change the email to pdf format. You need to convert the email to pdf file by some related add-ins or with VBA code. With the following article, you will easily save email as pdf file in Outlook.

Save email as pdf file in Outlook with VBA code

Bulk save multiple emails as pdf file or other file formats with Bulk Savegood idea3


Save email as pdf file in Outlook with VBA code

1. Firstly you should select the email that you want to save as PDF.

2. Press Alt + F11 to launch the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, then copy and paste the following VBA code to the Module window.

The VBA code of saving email as PDF file:

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

Note: This VBA code have successfully tested in Outlook 2007 and 2010

4. Click to run the code.

5. There will be a File Save dialog popping up while the code is running. Select a path to save the file, name it, and finally click on Save button.

6. When the code finish running, the email have successfully converted to pdf file.


Bulk save multiple emails as pdf file or other file formats with Bulk Save

With Kutools for Outlook installed, you can use its Bulk Save utility to quickly save or export the selected emails to PDF files/Excel files/CSV files or other file formats.

Kutools for Outlook, includes powerful features and tools for Microsoft Outlook 2019, 2016, 2013, 2010 and Office 365.

1. In an email folder, select the messages you want to save as PDF, click Kutools > Bulk Save.
doc kutools bulk save 1

2. In the Bulk Save dialog, select a path to place the new files, check PDF format, and you can specify the Save content as you need.
doc save email as pdf 4

3. Click Ok. Then the selected emails have been saved as PDF files individually.
doc save email as pdf 5


Best Office Productivity Tools

Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook

🤖 AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...

📧 Email Automation: Out of Office (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

📨 Email Management: Easily Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Boost Your Outlook Productivity with Tabbed Views  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Incoming Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Over 100 Features Await Your Exploration! Click Here to Discover More.

Read More       Free Download      Purchase
 

 

Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
or (but for this you need to open the mail) you could use this:
ActiveInspector.WordEditor.ExportAsFixedFormat "c:\temp\test.pdf",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

This comment was minimized by the moderator on the site
Hi !!
I have follow all the instructions but it doesn't work, " Compile error : Syntax error"
Can you help me ? Please
Amaury
This comment was minimized by the moderator on the site
This macro is really great and easy to use as well,thank you so much for sharing this.
Just wanted to check is it possible to create same kind of macro for PDF attachment as well,because the above macro works only for excel and word format.

Can any one one help me on this.
This comment was minimized by the moderator on the site
I am wondering how I could change the folder the pdf goes to and change the filename(since all the emails I am copying are called the same thing
This comment was minimized by the moderator on the site
Been wondering how to do this for years, very easy, thank you
This comment was minimized by the moderator on the site
Hi All, PDF is saving in default size and I can't see all text, tables, etc. from email. How can I fix that? Is it any way to save email as PDF file in responsive size?
This comment was minimized by the moderator on the site
The VBA code works perfectly! Now, is there any way to adjust this in order to default "save as" to be .msg in Outlook 2007?
This comment was minimized by the moderator on the site
I have been able to use this. But now when I run it is just saving a copy of this page. I get a PDF of the instructions rather than the email I was trying to convert. Any suggestions?
This comment was minimized by the moderator on the site
Super, worked like a charm. Thank you very much
This comment was minimized by the moderator on the site
Many thanks, friend. This was a great help.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations